Git: How to keep local feature branch updated with changes made in dev?

I’ve been following this guide for working with distributed git projects: http://nvie.com/posts/a-successful-git-branching-model/. It has worked well but now I have run into a snag. I have created a local feature branch. I would like to keep this feature branch up-to-date with the latest changes made in dev. Is this possible? I was researching this and found I would probably need to use rebase. But there were so many options I didn’t know exactly which one I needed to use. How would I do this?

  • TortoiseHg and multiple branches in one repo
  • Local branches with Bazaar?
  • What exactly do we mean by “branch”?
  • Git change branch, but don't change files in workspace
  • Pushing updates to a pruned Mercurial branch
  • When does git refresh the list of remote branches?
  • mac os x / github / multiple public keys?
  • dcommit only a certain local (i.e. git) branch with git-svn
  • Can't “pull” with smartgit, “fetch only” is available
  • Impossible to git rm with special characters
  • Git commit a commit message and nothing else?
  • Can I pull only certain files from another git repository?
  • 2 Solutions collect form web for “Git: How to keep local feature branch updated with changes made in dev?”

    Periodically:

    λ git checkout dev
    λ git pull origin dev
    λ git checkout myfeaturebranch
    λ git merge dev
    

    Running git rebase dev while on the feature branch should do the trick (update local dev from origin first, if necessary).

    That will replay your changes from the feature branch onto dev, then sets the feature head to be the head of the new history.

    Note: Only rebase if your feature branch commits have not yet been pushed. It will rewrite your history. There are some caveats with rebase which may or may not be worth the risk.

    Git Baby is a git and github fan, let's start git clone.