Reputation: 765
I was learning how to use SourceTree and git, and after experimenting I accidentally made a commit in the wrong branch, and it seems like my master
branch is no longer the main branch.
Here is an image of what my graph currently looks like.
I was wondering it is possible for me somehow make bugfix-z
branch my master
branch
Upvotes: 2
Views: 2119
Reputation: 116170
If you haven't pushed yet, you can easily revert the last commit using
git reset --soft HEAD~1
You can type in this command in the terminal (use the 'terminal' button on the right of the toolbar).
After that you can switch to the master branch and commit the changes again.
Upvotes: 1
Reputation: 1328762
Considering master
has been merged into bugfix-z
, a consider simple
git checkout master
git merge bugfix-z
That would fast-forward master
to bugfix-z
HEAD.
Upvotes: 1