Skip to content

Instantly share code, notes, and snippets.

@bondarewicz
Created January 29, 2020 14:05
Show Gist options
  • Save bondarewicz/66bacfade90d0578fed0beaf3e978047 to your computer and use it in GitHub Desktop.
Save bondarewicz/66bacfade90d0578fed0beaf3e978047 to your computer and use it in GitHub Desktop.
TBD Workflow

Dev1 creates a (short-lived) feature branch from trunk

git checkout master
git checkout -b feat-1

Dev1 do his work and commits there...

git add -A
git commit -m "f1"

Dev2 create another feature branch from trunk in the meantime

git checkout master
git checkout -b feat-2

Dev2 do his work and commits there...

git add -A
git commit -m "f2"

Team decides to introduce changes from feat-2 branch first, they squash merge feat-2 into master (via PR)

git checkout master 
git merge --squash feat-2
git commit (esc :wq)

Now Dev1 is ready to introduce his chnages to trunk, he rebase it agaist feat-1 branch (to avoid conflicts and allow fast forward merge)

git checkout feat-1
git rebase master
git add -A
git commit -m "f1.1"

Finally Dev1 squash merge feat-1 into master

git checkout master 
git merge --squash feat-1
git commit (esc :wq)

Final state of master

* eff0037 (HEAD -> master) f1
| * 58564e2 (feat-1) f1.1
| * 06dc37b f1
|/  
* 34d577b f2
| * 931bdc4 (feat-2) f2
|/  
* 9b1bc0b init
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment