b4oshany
(Oshane Bailey)
July 13, 2023, 6:58pm
1
Add a file to the staging area
git add <file>
To add all files in the current directory , use .
in place of <file>
.
git add .
Commit Changes
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>"
# or
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
1 Like
b4oshany
(Oshane Bailey)
July 13, 2023, 6:59pm
2
Find branches the commit is on
git branch -a --contains <commit>
hassan
(Hassan Voyeau)
January 27, 2024, 1:22am
3
I wish there was an easy way to reset a github project.
b4oshany
(Oshane Bailey)
February 17, 2024, 1:15pm
4
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.
1 Like
hassan
(Hassan Voyeau)
February 17, 2024, 5:39pm
5
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.
b4oshany
(Oshane Bailey)
February 17, 2024, 6:49pm
6
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.
In my experience as a developer, the most useful git commands(unrelated to pushing to repository) would be git restore . and git stash(as well as git stash apply)