Skip to content

Instantly share code, notes, and snippets.

@philippetedajo
Last active July 7, 2021 15:20
Show Gist options
  • Save philippetedajo/02c498d6d783ba433c26e6627b145418 to your computer and use it in GitHub Desktop.
Save philippetedajo/02c498d6d783ba433c26e6627b145418 to your computer and use it in GitHub Desktop.
Git flow
//============= Assuming that we have our project with git initialized, create the Develop branch:
git branch develop
git push -u origin develop (if you are creating it)
git checkout -b develop origin/develop (if you are cloning and copying locally the develop branch)
// Create the a feature:
git checkout -b new-awesome-feature
git add <perfect-code-made-by-us>
git commit
//============= The new feature is completed and commited with the last command, so we need to merge it into Develop branch
//but first, let be sure that nothing has changed on this branch:
git pull origin develop (checking for up to date)
git checkout develop (switching to local develop branch)
git merge new-awesome-feature
git push
git branch -d new-awesome-feature (deleting the new feature branch)
//============= Prepare a new Release branch that will be used for testing, documentation
git checkout -b release-0.1 develop (creating the release branch)
//============== Ship it to production (Master) and Develop as well:
git checkout master (switching to local master branch)
git merge release-0.1 (merging)
git push
git checkout develop (switching to local develop branch)
git merge release-0.1 (merging as well)
git push
git branch -d release-0.1 (deleting the release branch)
//============== And don’t forget the tag :)
git tag -a 0.1 -m “new-feature completed and released” master
git push — tags
//=============== Create Hotfixes
git checkout -b issue-001 master (creating the hotfix branch)
git checkout master (bug/issue fixed and committed at this step)
git merge issue-001
git push
//=============== Merge Hotfixes into develop
git checkout develop
git merge issue-001
git push
git branch -d issue-001 (deleting the hotfix branch)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment