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?

  • creating git branch after the fact?
  • Cloning only a specific branch on Github?
  • git move a branch's start forward in the tree
  • Eclipse project with Subclipse: Introduce trunk and branches
  • How to delete a remote branch using Git?
  • git shallow clone (clone --depth) misses remote branches
  • unable to commit a file, accidentally renamed with mv
  • How to discard the changes I don't commit?
  • What does FETCH_HEAD in Git mean?
  • git command auto complete on tab not working in sub directories on mac
  • RPM spec files in version control system
  • Git - resolve conflicts partially and send changes to somebody else to finish solving
  • 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.