Add a file to the staging area
git add <file>
To add all files in the current directory, use
. in place of
git add .
Commit changes that are already tracked and staged
git commit -m "<message>"
If you want to add all changes made to tracked files & commit
git commit -a -m "<message>"
git commit -am "<message>"
Amend or change the last commit message
git commit --amend
Amend and add new changes to the last commit
git commit -a --amend
Find branches the commit is on
git branch -a --contains <commit>
I wish there was an easy way to reset a github project.
I believe there’s a command for it, but i just normally delete .git folder and re-init the project. I’m assuming that’s what you mean by reset.
Reset meaning deleting the .git folder and starting again. This works locally but not on github. Dont remember what happens when this is tried. I think github still keeps the history. I will have to try again.
Yea, its done locally, but what I normally do afterwards is to do a force push to the repo with the delete all remote branch commands.
Apart from that, I believe Gitlab has something to reset the project. I’m not sure about Github.