0

I am using Git flow and I started out with a develop branch, master branch. Later, created a feature branch branching off of develop and when the functionality was complete, I merged it back to develop. Next time, Instead of creating a new feature branch, I created a new branch and added commits on that. Currently, I am on Origin/Mybranchname instead of develop/my-feature-branch. How do I make my current branch converted as a feature branch that branches off of develop?

Azmeena
  • 29
  • 3
  • 5

1 Answers1

0

You need to rename your branch so it follows the convention of feature branches, and then to rebase your branch onto the develop branch.

To rename your current branch, check out your branch and use git branch -m:

git checkout my-branch-name
git branch -m feature/my-branch-name

Once your feature branch has been appropriately renamed, you can proceed with the rebase. Make sure you have the latest origin/develop changes using git fetch, and then rebase your feature branch onto origin/develop using git rebase:

git fetch
git rebase origin/develop

Depending on whether your changes overlap with the ones that have been done on origin/develop, you may have merge conflicts. You can fix these conflicts similarly to the ones you may have had in the past with git merge.

Pierre
  • 1,068
  • 1
  • 9
  • 13
  • I am using git flow for visual studio. Is there a way to rename the branch as a feature branch through visual studio? – Azmeena Jun 10 '18 at 03:38
  • Yes sure, you just need to convert the commands into GUI clicks. I don't own a version of Visual Studio and cannot tell you about the exact buttons you need to press, but the process should be very similar to the command-line-based process. Try to find the equivalent of `git branch -m`, `git fetch` and `git rebase` in your GUI and you should be good to go. – Pierre Jun 10 '18 at 03:44
  • My remotes/origin are origin/my current branch instead of origin.develop. The master and develop are not being tracked by remote. what is the way to clean this up? – Azmeena Jun 10 '18 at 14:09