[{TableOfContents}] This is for keeping your branch up to date and always having a PR / MR with only one commit. It is helpful if you use Oh-My-Zsh. !!! Squashing Your Branch || Description || Zsh || Git | Checkout branch | {{{gco $branch_name}}} | {{{git checkout $branch_name}}} | How many commits to squash | {{{git rev-list --count master..}}} | {{{git rev-list --count master..}}} | Rebase your branch from HEAD[1] | {{{grbi HEAD~$Y}}} | {{{git rebase -i HEAD~$Y}}} | Force push your branch | {{{ggfl}}} | {{{git push --force-with-lease origin $current_branch}}} [#1] {{$Y}} is displayed in GitLab at the top, where it says ''Overview: X, Commits: Y, Pipelines: Z, ...'' . The number you want is Y. !!! Update From Master Time passes, commits get merged to master. You need to update your branch. || Description || Zsh || Git | Checkout master | {{{gcm}}} | {{{git checkout master}}} | Pull | {{{gl}}} | {{{git pull}}} | Checkout branch | {{{gco $branch_name}}} | {{{git checkout $branch_name}}} | Rebase from master | {{{grbm}}} | {{{git rebase master}}} | Handle conflicts, test, etc. | Force push {{{$current_branch}}} to remote | {{{ggfl}}} | {{{git push --force-with-lease origin $current_branch}}} !!! Push to Master Checkout master, merge feature branch into master, push master || Description || Zsh || Git | Checkout master | {{{gcm}}} | {{{git checkout master}}} | Merge feature branch into master | {{{gm $feature_branch}}} | {{{git merge $feature_branch}}} | Push master| {{{ggp}}} | {{{git push origin master}}} ---- [CategoryComputing.SCM.Git]