Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitSheet #5

Open
tg-z opened this issue Jan 16, 2021 · 0 comments
Open

GitSheet #5

tg-z opened this issue Jan 16, 2021 · 0 comments

Comments

@tg-z
Copy link
Owner

tg-z commented Jan 16, 2021

A dead simple git cheatsheet. Follow @tiivik for updates!

Branches.
git branch List all local branches.
git branch -a List remote and local branches.
git checkout -b branch_name Create a local branch and switch to it.
git checkout branch_name Switch to an existing branch.
git push origin branch_name Push branch to remote.
git branch -m new_name Rename current branch.
git branch -d branch_name Delete a local branch.
git push origin :branch_name Delete a remote branch.
Logs.
--- --- ---
git log --oneline Show commit history in single lines.
git log -2 Show commit history for last N commits.
git log -p -2 Show commit history for last N commits with diff.
git diff Show all local file changes in the working tree.
git diff myfile Show changes made to a file.
git blame myfile Show who changed what & when in a file.
git remote show origin Show remote branches and their mapping to local.
Cleanup.
--- --- ---
git clean -f Delete all untracked files.
git clean -df Delete all untracked files and directories.
git checkout -- . Undo local modifications to all files.
git reset HEAD myfile Unstage a file.
Tags.
--- --- ---
git pull --tags Get remote tags.
git checkout tag_name Switch to an existing tag.
git tag List all tags.
git tag -a tag_name -m "tag message" Create a new tag.
git push --tags Push all tags to remote repo.
Stashes.
--- --- ---
git stash save "stash name" && git stash Save changes to a stash.
git stash list List all stashes.
git stash pop Apply a stash and delete it from stash list.

https://gitsheet.wtf/?ref=producthunt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant