Back to Basics

Git Rebase Strategi

Håll en ren, linjär historik.

Idealiskt lämpad för högpresterande team och individuella funktionsgrenar. Håller historiken linjär och ren.

Arbetsflödet

$ git checkout -b jz-my-branch
# make my changes
$ git push origin jz-my-branch
# create a Merge Request

# three days go by and now my branch is out of sync with master
$ git fetch origin master
$ git rebase origin/master
$ git push --force origin jz-my-branch

Obs: Genom att använda rebase behöver du bara lösa sammanslagningskonflikter för nyare commits. Det ger en bättre upplevelse.

Rensa Upp

# Clean up your branch (warning will delete everything not matching remote)

git fetch --prune origin
git reset --hard origin/master
git clean -f -d

# Setting your branch to exactly match the remote branch:
git fetch origin
git reset --hard origin/master