Git useful tips - rosalsm/TIY-GitHub GitHub Wiki
Delete a commit in terminal
-
Check the commits in the repo first doing
git log -n 4
. -
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 wordpick
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). -
Force push to the remote repo
git push -f origin master
Push a project into an existing repo
- Clone the repo in your local directory
git clone URL
- Add the project to the directory and
git add project/*
(* super important in order to send all the files) - Commit
git commit -m'message'
- Push to the remote repo
git push -u origin master