Comandos Básicos de Git
[ Pendiente por traducción ]
Fuente: http://jonas.nitro.dk/git/quick-reference.html
a) Buscando Ayuda:
1. git help command ó git command --help
Show help for a command
b) Creación de un repositorio:
2. git init
Create a repository in the current directory
3. git clone url
Clone a remote repository into a subdirectory
c) File operations:
4. git add path
Add file or files in directory recursively
5. git rm path
Remove file or directory from the working tree
-f : Force deletion of file(s) from disk
6. git mv path destination
Move file or directory to new location
-f : Overwrite existing destination files
7. git checkout [rev] file
Restore file from current branch or revision
-f : Overwrite uncommitted local changes
d) Working tree:
8. git status
Show status of the working tree
9. git diff [path]
Show diff of changes in the working tree
10. git diff HEAD path
Show diff of stages and unstaged changes
11. git add path
Stage file for commit
12. git reset HEAD path
Unstage file for commit
13. git commit
Commit files that has been staged (with git-add)
-a : Automatically stage all modified files
14. git reset --soft HEAD^
Undo commit & keep changes in the working tree
15. git reset --hard HEAD^
Reset the working tree to the last commit
16. git clean
Clean unknown files from the working tree
e) Examining History:
17. git log [path]
View commit log, optionally for specific path
18. git log [from[..to]]
View commit log for a given revision range
--stat : List diffstat for each revision
-S'pattern' : Search history for changes matching pattern
19. git blame [file]
Show file annotated with line modifications
f) Remote repositories - remotes:
20. git fetch [remote]
Fetch changes from a remote repository
21. git pull [remote]
Fetch and merge changes from a remote repository
22. git push [remote]
Push changes to a remote repository
23. git remote
List remote repositories
24. git remote add remote url
Add remote to list of tracked repositories
g) Branches:
25. git checkout branch
Switch working tree to branch
-b branch : Create branch before switching to it
26. git branch
List local branches
27. git branch -f branch rev
Overwrite existing branch, start from revision
28. git merge branch
Merge changes from branch
h) Exporting and importing:
29. git apply - < file
Apply patch from stdin
30. git format-patch from[..to]
Format a patch with log message and diffstat
31. git archive rev > file
Export snapshot of revision to file
--prefix=dir/ : Nest all files in the snapshot in directory
--format=[tar|zip] : Specify archive format to use: tar or zip
i) Tags:
32. git tag name [revision]
Create tag for a given revision
-s : Sign tag with your private key using GPG
-l [pattern] : List tags, optionally matching pattern
j) File status flags:
M (modified) : File has been modified
C (copy-edit) : File has been copied and modified
R (rename-edit) : File has been renamed and modified
A (added) : File has been added
D (deleted) : File has been deleted
U (unmerged) : File has conflicts after a merge


