Last active
December 20, 2015 04:18
-
-
Save thejeshgn/6069497 to your computer and use it in GitHub Desktop.
my most imp git commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#beautiful logs | |
git log --graph --all --decorate | |
#show all the commits | |
git reflog | |
#reset to particular commit, cleans up the working dir (clears the staged file) | |
#Resets the index and working tree. Any changes to tracked files in the working tree since <commit> are discarded. | |
git reset --hard [commit_hash or tag] | |
#Remove untracked files from the working tree | |
#Cleans the working tree by recursively removing files that are not under version control, starting from the current directory. | |
git clean | |
#create a branch | |
git branch [new branch name] | |
#go to a branch | |
git checkout [branch] | |
#start local got server | |
git instaweb | |
#get content from remote | |
git fetch [remote-name] | |
#get content from remote and merge | |
git pull [remote-name] | |
#show all remotes | |
git remote -v | |
#add a remote | |
git remote add [name] [url] | |
#add tag | |
git tag [tag] -a -m "[my tagging message]" | |
#add a tag and gpg sign | |
git tag -s [tag] -m "[my tagging and signing message]" | |
#verify gpg sign tag | |
git tag -v [tag] | |
#show all the commits with signatures | |
git log --show-signature | |
#get all the tags from remote with content | |
git fetch origin --tags | |
#push all the tags to remote with content | |
git push origin master --tags | |
#list all the files in a repo | |
git --ls-files --stage | |
#add interactively | |
#Allows you to commit part changes in same file [using patches]. Lets say you made two changes in a file but want to | |
#stage only one change. You can use this command. | |
git add -i | |
#Who changed what | |
git blame [file] | |
#store the work you have been doing, so you can work on something else | |
git stash | |
#show all the stashes | |
git stash list | |
HEAD where your current pointer is, and thats where all the action takes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://pragmatictim.blogspot.in/2012/11/creating-signed-tags-in-git-from-scratch.html | |
So, there is another smart solution here - you can store the key as a Git object, and share it on a remote. This object will only hold a key data, and not the file name, or a commit information - that is pure Git object, nothing else: | |
$ git hash-object -w username.pub | |
f4a7478fb4543... | |
$ git tag username-pub-rsa f4a7478fb4543... | |
$ git push --tags | |
Voila. You've stored a public key in a Git repository, assigned a tag to it, and shared it. It is not a part of a commit, or any tracked file - it only exists inside Git internal objects storage and can be easily accessed using a tag assigned to it. So, once a user pulled the remote with a signer's public key already pushed to it, it can be easily seen in it: | |
$ git tag | |
username-pub-rsa | |
... other tags if any | |
And one can now easily extract it and add to a keyring, in order to later use for tag verification: | |
$ git cat-file blob username-pub-rsa | gpg --import |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://gitref.org