git stash
[wiki.git] / git.mdwn
1 [[!toc levels=3]]
2
3 ## Howto
4
5 ### How to tell which files git is tracking
6
7     git ls-files
8
9 ### How to get the short sha1 for a commit
10
11     git log --oneline
12
13 See also http://stackoverflow.com/questions/2405305/git-how-to-tell-if-a-file-is-git-tracked-by-shell-exit-code
14
15 ### How to use git stash
16
17 Undo your changes, show your stashes, and re-apply them
18
19     git stash
20     git stash list
21     git stash apply
22
23 http://git-scm.com/book/en/Git-Tools-Stashing
24
25 ### Fix your email address in your commits
26
27 https://help.github.com/articles/changing-author-info
28
29 http://stackoverflow.com/questions/750172/how-do-i-change-the-author-of-a-commit-in-git
30
31 http://git-scm.com/docs/git-rebase#_recovering_from_upstream_rebase
32
33 http://serverfault.com/questions/12373/how-do-i-edit-gits-history-to-correct-an-incorrect-email-address-name
34
35 ### Use git submodules
36
37 Once your submodules are all set...
38
39     git submodule init
40     git submodule update
41
42 http://chrisjean.com/2009/04/20/git-submodules-adding-using-removing-and-updating/
43
44
45 #### Remove a git submodule
46
47 > To remove a submodule you need to:
48
49 > 1. Delete the relevant line from the ''.gitmodules'' file.
50 > 1. Delete the relevant section from ''.git/config''.
51 > 1. Run ''git rm --cached path_to_submodule'' (no trailing slash).
52 > 1. Commit the superproject.
53 > 1. Delete the now untracked submodule files.
54
55 > -- https://git.wiki.kernel.org/index.php/GitSubmoduleTutorial