Committing Pushing
Committing/Pushing
$ git add .
$ git commit
$ git pushFix a commit
$ git commit -amendReset to last git commit
$ git reset --hard HEAD
# OR
$ git reset --hardUndo a commit without losing local files
git reset HEAD~1Commit specific lines of code
$ git add -p
>> Stage this hunk [y, n, ...]?Pick the chunks of code you do want to commit
stage this hunk means are you gonna commit this?
Options for Stage this hunk [y, n, ...]?
Stage this hunk [y, n, ...]?Press
?if you want more infoPress
nto go to next change
Note: Does not work for new files (i.e. if you do a touch, and try to do git add -p right after)
Delete file that is already in repo
If you want to delete this file that is already in the repo, use this to not commit file-name
Show changes between commits
when you do
yforgit add -p,git diffwill be empty (obviously)
Do not commit specific lines of code
.gitignore
.gitignoreChecking if something's really ignored
do
git statusand check if file still appears as red
Ignoring all types of a file extension, folder, or file
*.<file-extension>(eg. txt, swp)*<folder/file-name>
Get latest commit hash
Get commits different between two branches (parent and child)
Last updated
Was this helpful?