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.
omz> gco $branch_name zsh> git checkout $branch_name
$number_of_commits is displayed in GitLab at the top, where it says
Overview: X, Commits: Y, Pipelines: Z, ...
The number you want is Y.
omz> grbi HEAD~5 zsh> git rebase -i HEAD~$number_of_commits
omz> ggfl zsh> git push --force-with-lease origin $current_branch
Time passes, commits get merged to master. You need to update your branch.
omz> gcm zsh> git checkout master
omz> gl zsh> git pull
omz> gco $branch_name zsh> git checkout $branch_name
omz> grbm zsh> git rebase master
Handle conflicts, test, etc.
Force push $current_branch to remote.
omz> ggfl zsh> git push --force-with-lease origin $current_branch
Checkout master, merge feature branch into master, push master
omz> gcm zsh> git checkout master
omz> gm $feature_branch zsh> git merge $feature_branch
omz> ggp zsh> git push origin master