freele
12/8/2016 - 11:20 PM

Git workflow

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.