0

I have this alias in my git config

masterrebase= !git fetch origin --prune && git rebase origin/master && git push . origin/master:master 2> /dev/null

i am most interested in the last command and want to know what it does git push . origin/master:master

Raymond Chen
  • 44,448
  • 11
  • 96
  • 135
Justin Homes
  • 3,739
  • 9
  • 49
  • 78
  • Possible duplicate of [Merge, update, and pull Git branches without using checkouts](http://stackoverflow.com/questions/3216360/merge-update-and-pull-git-branches-without-using-checkouts) – Raymond Chen May 06 '16 at 19:43

1 Answers1

2

git push . origin/master:master is the reverse of git checkout master && git merge --ff-only origin/master.

It will update your local master branch with the commits from origin/master, but only if no merge commit is required (i.e. a fast-forward)

The first two commands will simply fetch new commits from the origin remote (and prune old/non-existing remote branches), and then rebase your current branch on top of the origin/master that was just fetched.

knittl
  • 246,190
  • 53
  • 318
  • 364