User login |
git cheat sheetHere is my personal git cheat sheet. Branches and tagsList branches local and remotegit branch -a Make a local branch track a specific remote branchgit branch --set-upstream localbranch origin/remotebranch push and delete remote brancheshttp://gitready.com/beginner/2009/02/02/push-and-delete-branches.html Restore a deleted tagThis is stolen from Baptiste Wicht blog post Git Tip : Restore a deleted tag. If you just deleted a tag by mistake, you can restore it following these steps. First, use git fsck --unreachable | grep tag then, you will see the unreachable tag. If you have several tags on the list, use git show KEY to find the tag you ate looking for and finally, when you know which tag to restore, use git update-ref refs/tags/NAME KEY and the previously deleted tag with restore with NAME. From http://www.baptiste-wicht.com/2011/06/git-tip-restore-a-deleted-tag/ Show current tagIf you have checked out a tag this command will give you the name of it. git describe --always --tag Diffs and patchesChanges between the index and your last commit; what you would be committing if you run "git commit" without "-a" option. git diff --cached No prefixes, remove the a and b directory prefixes. git diff --cached --no-prefix Manage commitsSquashing CommitsTo squash multiple commits into one before pushing to a remote repository you can use git-rebase. In it's simplest form and provided you want to manage all commits since last push. git rebase -i origin For more details see: Squashing Commits How To. Show incoming and outgoing commitsTo mimic hg incoming:
git log ..@{u}
To mimic hg outgoing:
git log @{u}..
http://stackoverflow.com/questions/231211/using-git-how-do-i-find-modifi... RCS KeywordsMost traditional version control systems do have support for keywords which is substituted by the version control system on check-out (or in some case check-in). Git does not provide this feature, since these types of substitutions does not make sense in DSCM tools like Git. Since there can be many different repositories independent of each other somebody could refer to version “1.41” of a file but your version “1.41” of that file is different. Even though I agree with Linus on the topic of keywords. Lucky enough there is project on git hub that provides git keyword filters. References
|