0

I'm working on a project which uses git-flow, where feature branches have been left dangling. I want to clean things up but I'm not very familiar with git-flow in practice.

I used Tower's git-flow "finish feature" on that branch, then noticed that my working directory now contains code that has been superseded a while ago.

In hindsight, I guess I should have rebased the code on the feature branch to use the latest develop branch available, which I thought git-flow did automatically.

How do I clean this mess (i.e. return my working directory to the latest status of the develop branch) and how do I merge old feature branches without reverting code?

Thanks!

Goulven
  • 777
  • 9
  • 20
  • Are you sure you want to merge these old branches? There are two ways to "finish" them as per [this answer](http://stackoverflow.com/questions/16403725/finishing-a-feature-branch-with-git-flow/16403826#16403826). One of your choices is to discard the branch without merging. – Wolf Jul 23 '15 at 13:39

1 Answers1

1

I'm not entirely sure I understood your problem.

Here's what I got :

You have a feature branch that you started a while ago, but several changes having been made on develop (master)

git checkout develop
git fetch -p
git pull origin develop (or whatever your main branch is called)
git checkout myfeaturebranch
git merge develop

Now some files will be correctly updated, but you'll most likely get conflicts if you touched the same files. The files with conflicts will show, but you can also check them by writing this command

git status

When you are done fixing the conflicts, just do the normal add and commit commands.

wsalame
  • 130
  • 1
  • 8