Pull latest changes from remote and push my changes as latest over it

I always use (since Git 2.6, Q3 2015)

git config --global pull.rebase true
git config --global rebase.autoStash true

That way, a simple git pull is enough to get A-->B-->D--->C automagically.


git fetch syncs the latest master.

After that in your branch run git rebase -i origin/master.

After rebasing push your branch to remote git push --force.

Now your branch aligns with master and your commit is the latest in the chain.

IMO it's OK to use git push --force in your branch (if you develop alone in there), but it's not OK to use it on master so be careful with that.