Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Changing the brunch of previous commits.

Guys, i am new to git and sourcetree - was using it only for 1 week, thank you for a great tool!

I started with master branch and made 10 commits. After i've read on proper work flow - i liked githubflow more than git flow - i realized that all this commits must be in different brench.

Basically same starting point(init commit) for [master] and [x-feature] branches, but all commits after 1st one must be in [x-feature] branch not the [master] branch.

Is there a way to change branch of already done commits?

1 answer

0 votes
Ana Retamal Atlassian Team May 17, 2017

Hi Den!

Undoing a commit can be a complex operation and the benefits you'll get are not that big. You can leave the current commits like that, and start with the new workflow from now onwards.

Anyway, if you'd like to go ahead with this you can do an interactive rebase. With the interactive rebase tool, you can stop after each commit you want to modify and change the message, add files, or do whatever you wish (like adding it to a new branch in your case). You can learn more about how to use interactive rebase at Rewriting History.

Keep in mind that if your commits have already been pushed to a central server, it's not recommended to perform this operation, as doing so will confuse other developers by providing an alternate version of the same change.

Lastly, this is more a matter of Git than SourceTree. If you have more GIt questions in the future, you can address them to the Git section within our Community :)

Hope this helps! 


Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Sourcetree

Sourcetree for Windows - CVE-2019-11582 - Remote Code Execution vulnerability

A vulnerability has been published today in regards to Sourcetree for Windows.  The goal of this article is to give you a summary of information we have gathered from Atlassian Community as a st...

5,239 views 0 12
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you