Skip to content

Instantly share code, notes, and snippets.

@freele
Forked from rymawby/git-workflow.sh
Last active March 31, 2021 05:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save freele/9f6bc008f77b3944ccc4865caf8dfb06 to your computer and use it in GitHub Desktop.
Save freele/9f6bc008f77b3944ccc4865caf8dfb06 to your computer and use it in GitHub Desktop.
Git workflow
# Create a feature branch
# Typically, branch from the current develop branch:
git fetch
git checkout develop.xx
git pull origin develop.xx
git checkout -b <BRANCH_NAME>
# Make atomic commits
git add .
git commit -m "Did something awesome."
# Squash commits
# When development is complete, squashing tidies up history and makes rebasing much easier.
git rev-list --count HEAD ^SPRINT_XX
git rebase -i HEAD~X
# where X is the number of commits made on the development branch (you can get this by using the rev-list call on the line above)
# Rebase against the develop branch
git checkout develop.xx
git pull origin develop.xx
git checkout -
git rebase develop.xx
# Manage any conflicts. Then, ensure that all tests still pass and that the application still works as expected.
# Or you can squash commits here, if you did not do it before rebase to develop.xx branch
git rebase -i develop.xx
# Push the branch
git push -f origin <BRANCH_NAME>
# Create a pull request
# Action any changes that come out of the code review, making sure to again squash and rebase once these have been done.
# The pull request should not be merged by the developer who has raised it. Paste the link to the PR into a Skype chat if you need it actioned quickly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment