3

I'm trying to follow this model: http://nvie.com/posts/a-successful-git-branching-model/

And trying to understand how a merge like this would work from a pull request on Github... specifically the "--no-ff" flag:

git merge --no-ff hotfix-1.2.1

Additionally, after the PR request has been merged on Github, what is the best way to bring those updates into my local master branch? Would it just be:

git pull github-remote-branch
  • there is good explanation on `--no--ff` flag here: http://stackoverflow.com/questions/9069061/what-is-the-difference-between-git-merge-and-git-merge-no-ff – rattanak Feb 15 '16 at 20:14
  • the second part of your question, normally I just do: `git checkout master`, then `git pull` – rattanak Feb 15 '16 at 20:15
  • When using the git-flow workflow with GitHub's pull requests, have a look into the git extension [HubFlow](https://datasift.github.io/gitflow/). – das-g Feb 15 '16 at 21:06

1 Answers1

3

Pull request merges on GitHub always create a new commit, so they already act like git merge --no-ff ....

[A]fter the PR request has been merged on Github, what is the best way to bring those updates into my local master branch?

If your local master branch is set up to track the remote master branch, just do

git checkout master
git pull --ff-only

This will abort with an error if you have commits on local master branch that aren't on the remote master branch. (The default without --ff-only would have been to merge.)

das-g
  • 9,718
  • 4
  • 38
  • 80
  • my local git has a few remotes set up. how do i know which remote my local master is tracking against? right now i push my local master branch to github and to heroku. – HelpMeStackOverflowMyOnlyHope Feb 15 '16 at 20:37
  • if i wanted to explicitly state which remote to pull from how would i do that with the --ff-only flag? – HelpMeStackOverflowMyOnlyHope Feb 15 '16 at 20:37
  • To see the name, URLs and other details about the remote of the branch that local `master` branch is tracking, use `git remote show $(git config --get branch.master.remote)`. – das-g Feb 15 '16 at 21:04
  • You can combine the `--ff-only` option with explicitly naming the remote to pull from: `git pull github-remote-branch --ff-only` – das-g Feb 15 '16 at 21:05