Skip to content

Instantly share code, notes, and snippets.

@agatawitkowska
Created July 1, 2018 14:47
Show Gist options
  • Save agatawitkowska/b553fd161ae7a42946d1a9b4cbff0ccb to your computer and use it in GitHub Desktop.
Save agatawitkowska/b553fd161ae7a42946d1a9b4cbff0ccb to your computer and use it in GitHub Desktop.
Removing wrong commit in a GitHub repo through bash-Git
#Removing commit in GitHub repository through git in the command line
#1. Open git through command line or bash
#2. After setting a username and commit email address connect to Github's reposirory:
git clone <repository's url with .git>
cd <repository's name>
git rebase -i HEAD~1 #for editing last commit
#now a text editor will open with commit's details and possible actions, exchange "pick" in the first line with the desired command, save file, and close file. Rest is done automatically
#3. Push the commit to GitHub:
git push origin master --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment