Command | Description |
---|---|
git mv {old_name} {new_name} |
rename |
git commit -- ammend |
edit most recent commit (do before pushing to remote) |
git reset HEAD {file_name} |
unstage |
git restore --staged {file_name} |
unstage |
git checkout -- {file_name} |
replace with last committed version (dangerous: discards all local changes) |
git restore {file_name} |
replace with last committed version (dangerous: discards all local changes) |
git remote add {shortname} {url} |
add new remote repo as a shortname |
git fetch |
pulls data down, does not merge |
git pull |
pulls data down, merges |
git push {remote} {branch} |
push branch to remote server |
git remote rename {old_shortname} {new_shortname} |
rename shortname |
lightweight tag | pointer to a specific commit |
annotated tag | full object -> more info |
git tag -a {version_id} -m {message} |
make an annotated tag |
git show {tag_id} |
see data for specific tag |
git push origin {tag_id} |
push tag to remote (tags are local by default) |
git push origin --tags |
push all tags to remote |
git tag -d {tag_id} |
delete tag (local) |
git push origin :regs/tags/{tag_id} |
remove tag from remote |
git push origin --delete {tag_id} |
remove tag from remote |
git config --global alias.{short_name} {command} |
make an alias to a command (git doesn't infer partial commands) |
git config --global alias.{short_name} !{external_command} |
make an alias to an external command |
Last active
October 15, 2021 03:04
-
-
Save alyoshenka/3f1a1d4e8d2e569d9453bb650784b909 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment