Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

git cancel last commit

git reset --soft HEAD~1
Comment

undo last commit

#this  will preserve changes done to your files
git reset --soft HEAD~1

#this will get rid of the commit and the changes done to the files
$ git reset --hard HEAD~1
 
Comment

git undo last commit

# Undo last commit.
# --soft flag makes sure that the changes in undone revisions are preserved.
# You'll find the changes as uncommitted local modifications in your working copy.
git reset --soft HEAD~1

# If you don't want to keep these changes, simply use the --hard flag.
# This will completely remove the changes.
git reset --hard HEAD~1
Comment

revert last commit

git reset HEAD~ 
Comment

reset or revert last commit

git reset --hard HEAD~1
git push origin HEAD --force
Comment

undo last commit

$ git reset --hard HEAD~1
Comment

git revert last commit

git revert HEAD
Comment

revert last commit git

$ git commit -m "Something terribly misguided" # (0: Your Accident)
$ git reset HEAD~                              # (1)
[ edit files as necessary ]                    # (2)
$ git add .                                    # (3)
$ git commit -c ORIG_HEAD                      # (4)
Comment

how to recover last commit git

//the below code can recover your last commited files 
git checkout -f 
Comment

undo last commit git

git revert <commit to revert>
Comment

revert last commit

git revert <commit hash of the commit to revert>
Comment

revert last commit git

File > Other Settings > Settings for New Project > Version Control > Confirmation > When files are created > Do not add
Comment

reset git from last commit

$ git clean -fd
Comment

PREVIOUS NEXT
Code Example
Shell :: bash if set variable 
Shell :: how to install older version of tensorflow 
Shell :: git command history 
Shell :: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list.d/pgdg.list:1 and /etc/apt/sources.list.d/pgdg.list:2 
Shell :: kernel headers were not found vmware kali linux 
Shell :: how to get git stash changes back 
Shell :: Creating Public Key 
Shell :: upgrade ubuntu command line 
Shell :: bash length of array 
Shell :: Host key verification failed. fatal: Could not read from remote repository. 
Shell :: docker image rm image without tag 
Shell :: wget file from google drive 
Shell :: download nodejs debian linux 
Shell :: leaflet install yarn 
Shell :: how to upgrade to wsl 2 
Shell :: Cannot find cairo.h! Please install cairo 
Shell :: check how many container running or not running in docker 
Shell :: git diff of a file between two commits 
Shell :: bash grep for two terms in same line 
Shell :: firebase kill port 
Shell :: installer lamp ubuntui 
Shell :: sh or bash validate if file no exist 
Shell :: ubuntu install gnote 
Shell :: bash copy directory and all contents 
Shell :: php install extension 
Shell :: win add to startup 
Shell :: how to enable gitlab runner to use local docker images 
Shell :: mssql-tools : depends: msodbcsql17 (= 17.3.0.0) but it is not going to be installed 
Shell :: git move head to specific branch 
Shell :: mysql2 install error ruby 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =