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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

How do I undo a sourcetree pull from branch into master

Edited

I have only used Sourcetree for a single branch. Now I have been working on a dev branch on a laptop while I was away. When I got back to my desktop, I didn't know that I had to checkout the dev branch (again, sorry for being such a newb) and I did a pull thinking it would know to create the dev branch, and it all went into the master. So now my master branch and dev branch look exactly the same. I now have checked out the dev branch to the desktop, but the master and the dev branch still look the same in terms pf commits. So do I now just 'remove' the commits to master?

 

TIA,

Scott

1 answer

It sounds like you are wanting to do a hard reset - effectively 'delete' the merge with master that happened.

If that is so, there are two ways I can think of.

You can tell git/Sourcetree to reverse the merge commit - to undo the changes introduced from the merge, but creating a new commit - still showing that a merge with master happened.

Or you can hard reset your working branch to a previous commit if you want it to look like the merge never happened. Make sure you pick the correct commit you want to reset to.

*Note if you have already pushed this unwanted commit to a remote, you will have to force push after your hard reset to overwrite the branch on the remote. Otherwise git/Sourcetree will not allow you to push your changes because it will say that your branch doesn't match the remote and needs to be merged with it - and if you did that, it would re-introduce the commit you don't want.

Reverting the commit would be the more mainstream/recommended way of using git, rather than a hard reset. But I find myself doing a hard reset and force push from time to time.

Hard reset.gif

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events