Reset commit in SourceTree

I have 2 branches master and bugfix . my current branch is bugfix , where I made my changes (didn't push), now I need to reset to commit.

If I reset my commit, will it affect other commits in the master branch?

Actually, I want to remove this commit.

 git reset --soft 734e3a0 

I am using SourceTree.

+5
source share
5 answers

You need to run this command in the terminal of the source tree git reset --soft HEAD~1 so that this command undoes your commit in your sourtree. then you take the last attraction, and then you can commit your code.

+4
source

Just go to the log / history in the source tree, select the previous commit commit that we want to cancel, and right-click and make the 'Reset current branch for this commit' This will undo your committed changes (which were not pressed).

This will not affect anything in the main branch.

+3
source

I don't think that executing git reset --soft will affect any commits. This will only affect your branch.

If you want to return commit 734e3a0 , you can try using git revert :

 git revert 734e3a0 

This will give Git a command to add a new commit that cancels all 734e3a0 . Please note that this is a good option if this commit is in the middle of a branch, and it is also a good option for a branch whose history has already been published.

+1
source

First of all, you should ask yourself what you want to do.

What is reset for?

I assume that you want to change undo your changes. You have several options that you can read about here:

How to move HEAD back to the previous place? (Separate head)

It explains in detail what to do in each option.


What needs to be done?

You need to configure HEAD to indicate a new (or old) message.
The above article will show you and teach you what to do, and show you several options.

+1
source

If you did not push your code to the remote, you can revert your change by following the steps shown in the figure. But please BACKUP your changes first revert changes 1. Go to the SourseTree terminal
2. Run the git reset HEAD~ command

Then go to file status and check.


0
source

Source: https://habr.com/ru/post/1244169/


All Articles