Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

cancel a commit not pushed

git reset --soft HEAD~
Comment

git delete pushed commit

git reset --hard <last_working_commit_id>

git push --force
Comment

delete a pushed commit

# delete the last commit
$git reset –hard HEAD~
Comment

remove commit not pushed

git reset --hard origin/main
Comment

git remove last pushed commit

git reset --hard 'xxxxx'

git clean -f -d

git push -f
Comment

git delete pushed commit

git reset --hard your local branch to remove changes from working tree and index, 
git push --force (or git push --force-with-lease) your revised local branch to the remote

check the full answer from here 
https://stackoverflow.com/questions/3293531/how-to-permanently-remove-few-commits-from-remote-branch
Comment

delete last pushed commit

$ git reset <previous label or sha1>
$ git commit -am "blabla"                    <--- optional
$ git push -f <remote-name> <branch-name>    
Comment

github undo last pushed commit

git reset <previous label or sha1>
git commit -am "blabla"
git push -f <remote-name> <branch-name>
Comment

how to undo a commit that has not been pushed

Run the following command to revert the last commit.


$ git reset --soft HEAD~


Note: You can specify multiple commits by placing a number at the end.

For instance, if we want to undo the last two commits,
we can run the following command.


$ git reset --soft HEAD~2
Comment

delete a pushed commit

$git log --pretty=oneline --abbrev-commit
Comment

PREVIOUS NEXT
Code Example
Shell :: history suggestion in terminal 
Shell :: powershell keep skype active 
Shell :: how download google drive file with wget 
Shell :: conda install django rest framework 
Shell :: codeigniter 4 install composer 
Shell :: The requested nginx plugin does not appear to be installed certbot 
Shell :: how to uninstall kernel jupyter 
Shell :: git show only files names 
Shell :: change owner directory linux 
Shell :: git clone file name too long 
Shell :: docker wordpress plugins permissions 
Shell :: git commit amend without changing message 
Shell :: Install "repo" 
Shell :: pip install tensorflow not working 
Shell :: Install yarn via npm global 
Shell :: elementary-tweaks 
Shell :: install jupyter notebbok in pip 
Shell :: how to undo git remote origin 
Shell :: bash create file with content 
Shell :: git delete all branches except master 
Shell :: java change version mac 
Shell :: convert back to sh from zsh 
Shell :: force remove directory windows 
Shell :: Check cpu raspberry pi 
Shell :: remove netbeans snap 
Shell :: linux opengl 
Shell :: install ldapsearch 
Shell :: git merge cancel 
Shell :: git push current project to master 
Shell :: install nodemon typescritp 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =