User Tools

Site Tools


git_reference

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

git_reference [2017/02/02 22:08]
maefloresta created
git_reference [2019/07/16 20:31]
Line 1: Line 1:
-;#; 
-[[developer_resources|Back to Developers Page]] 
-;#; 
  
-Source: http://​jonas.nitro.dk/​git/​quick-reference.html 
- 
-a) Getting help: 
- 
-    * Show help for a command 
-      * git help command OR git command --help 
- 
-b) Repository creation: 
- 
-    * Create a repository in the current directory 
-      * git init 
-    * Clone a remote repository into a subdirectory 
-      * git clone url 
- 
-c) File operations: 
- 
-    * Add file or files in directory recursively 
-      * git add path 
-    * Remove file or directory from the working tree 
-      * git rm path 
-        * -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 
- 
-17. git stash 
- 
-    Record the current state of the working directory and clean it 
- 
-e) Examining History: 
- 
-18. git log [path] 
- 
-    View commit log, optionally for specific path 
- 
-19. 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 
- 
-20. git blame [file] 
- 
-    Show file annotated with line modifications 
- 
-f) Remote repositories - remotes: 
- 
-21. git fetch [remote] 
- 
-    Fetch changes from a remote repository 
- 
-22. git pull [remote] 
- 
-    Fetch and merge changes from a remote repository 
- 
-23. git push [remote] 
- 
-    Push changes to a remote repository 
- 
-24. git remote 
- 
-    List remote repositories 
- 
-25. git remote add remote url 
- 
-    Add remote to list of tracked repositories 
- 
-g) Branches: 
- 
-26. git checkout branch 
- 
-    Switch working tree to branch 
- 
-      -b branch : Create branch before switching to it 
- 
-27. git branch 
- 
-    List local branches 
- 
-28. git branch -f branch rev 
- 
-    Overwrite existing branch, start from revision 
- 
-29. git merge branch 
- 
-    Merge changes from branch 
- 
-h) Exporting and importing: 
- 
-30. git apply - < file 
- 
-    Apply patch from stdin 
- 
-31. git format-patch from[..to] 
- 
-    Format a patch with log message and diffstat 
- 
-32. 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: 
- 
-33. 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 
- 
-;#; 
-[[developer_resources|Back to Developers Page]] 
-;#; 
git_reference.txt ยท Last modified: 2019/07/16 20:31 (external edit)