Git useful tips - rosalsm/TIY-GitHub GitHub Wiki

Delete a commit in terminal

  1. Check the commits in the repo first doing git log -n 4.

  2. You need to look for the commit of the situation where you want to come back and use the number of the previous one and git rebase -i (commit_id) your text editor will open and you have to see the word pick in front of the commits that you want to delete plus one you want to save (you can't delete all of the commits or it doesn't work).

  3. Force push to the remote repo git push -f origin master

Push a project into an existing repo

  1. Clone the repo in your local directory git clone URL
  2. Add the project to the directory and git add project/* (* super important in order to send all the files)
  3. Commit git commit -m'message'
  4. Push to the remote repo git push -u origin master