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: 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?

  • Rename merged branch name in bitbucket
  • git-svn - Checkout a remote branch that already exists in svn when my master is already a branch. Explain this .git/config
  • Is there one git command to create a branch, switch to it, and link it to it's remote counterpart?
  • Correct procedure to use pending branch changes in a new branch
  • One line if statement in Ruby
  • How do I manage multiple development branches in Git?
  • git push to GitHub repository branch gives error “src refspec master does not match any”
  • Difference between TortoiseGit Git Sync and Pull?
  • Git Ignore Files per Branch
  • git add in Xcode generates error -70
  • Jcabi Github ExceptionInInitializerError
  • How to check file creation date with github api
  • 2 Solutions collect form web for “Git: How to keep local feature branch updated with changes made in dev?”


    λ 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.