add code.org to intro and fix typo
[wiki.git] / git.mdwn
1 [[!toc levels=3]]
2
3 ## Howto
4
5 ### How to undo/revert your last commit 
6
7     git reset --soft HEAD^
8
9 ### How to tell which files git is tracking
10
11     git ls-files
12
13 ### How to get the short sha1 for a commit
14
15     git log --oneline
16
17 See also http://stackoverflow.com/questions/2405305/git-how-to-tell-if-a-file-is-git-tracked-by-shell-exit-code
18
19 ### How to use git stash
20
21 Undo your changes, show your stashes, and re-apply them
22
23     git stash
24     git stash list
25     git stash apply
26
27 http://git-scm.com/book/en/Git-Tools-Stashing
28
29 ### Fix your email address in your commits
30
31 https://help.github.com/articles/changing-author-info
32
33 http://stackoverflow.com/questions/750172/how-do-i-change-the-author-of-a-commit-in-git
34
35 http://git-scm.com/docs/git-rebase#_recovering_from_upstream_rebase
36
37 http://serverfault.com/questions/12373/how-do-i-edit-gits-history-to-correct-an-incorrect-email-address-name
38
39 ### Use git submodules
40
41 Once your submodules are all set...
42
43     git submodule init
44     git submodule update
45
46 http://chrisjean.com/2009/04/20/git-submodules-adding-using-removing-and-updating/
47
48 #### Remove a git submodule
49
50 > To remove a submodule you need to:
51
52 > 1. Delete the relevant line from the ''.gitmodules'' file.
53 > 1. Delete the relevant section from ''.git/config''.
54 > 1. Run ''git rm --cached path_to_submodule'' (no trailing slash).
55 > 1. Commit the superproject.
56 > 1. Delete the now untracked submodule files.
57
58 > -- https://git.wiki.kernel.org/index.php/GitSubmoduleTutorial
59
60 ## Learning git
61
62 http://pcottle.github.io/learnGitBranching/?NODEMO
63
64 http://think-like-a-git.net
65
66 http://try.github.io/levels/1/challenges/1
67
68 https://github.com/gazler/githug
69
70 ## fast forward
71
72 http://nathaniel.themccallums.org/2010/10/18/using-git-fast-forward-merging-to-keep-branches-in-sync/
73
74 http://365git.tumblr.com/post/504140728/fast-forward-merge