how_to_work_with_git
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
how_to_work_with_git [2017/10/02 11:56] – tsaue | how_to_work_with_git [2017/10/02 13:11] – tsaue | ||
---|---|---|---|
Line 4: | Line 4: | ||
Git is a program that helps multiple developers work together on a program simultaneously. Every revision to the source code is retained, so if something goes wrong it is always possible to go back to a previous state. | Git is a program that helps multiple developers work together on a program simultaneously. Every revision to the source code is retained, so if something goes wrong it is always possible to go back to a previous state. | ||
- | === Main differences that surprise Subversion users === | + | ==== Main differences that surprise Subversion users ==== |
You can probably skip this if you have never worked with Subversion or CVS. | You can probably skip this if you have never worked with Subversion or CVS. | ||
Line 23: | Line 23: | ||
$ git config --global color.diff | $ git config --global color.diff | ||
$ git config --global color.status auto | $ git config --global color.status auto | ||
+ | |||
+ | Identify yourself - set your name and your e-mail: | ||
+ | |||
+ | $ git config --global user.name "Slim Shady" | ||
+ | $ git config --global user.email slim.shady@ctcc.no | ||
+ | |||
+ | Set the default mode for git push (current, matching or tracking): | ||
+ | |||
+ | $ git config --global push.default current | ||
+ | |||
+ | Disable fast-forward merges (read for instance [[http:// | ||
+ | |||
+ | $ git config branch.master.mergeoptions " | ||
+ | |||
+ | === Recommended reading and viewing === | ||
+ | |||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * A very nice branching model with branching and merging examples is found [[http:// | ||
+ | * And finally a [[http:// | ||
+ | * The following man pages can be useful as well (especially when you are not online): | ||
+ | |||
+ | $ man gittutorial | ||
+ | $ man gittutorial-2 | ||
+ | $ man gitcore-tutorial | ||
+ | $ man gitworkflows | ||
+ | $ man gitglossary | ||
+ | |||
+ | === Basic work === | ||
+ | |||
+ | You can live a fulfilled life with the following few Git commands: | ||
+ | * Clone the repository (checkout a working copy in Subversion speak): | ||
+ | |||
+ | $ git clone git@repo.ctcc.no: | ||
+ | |||
+ | * Update your repository with changes from origin (svn update): | ||
+ | |||
+ | $ git pull | ||
+ | |||
+ | * Browse the history: | ||
+ | |||
+ | $ git log --topo-order --decorate [--oneline --graph] | ||
+ | |||
+ | * Add a file: | ||
+ | |||
+ | $ git add | ||
+ | |||
+ | * Move or rename: | ||
+ | |||
+ | $ git mv | ||
+ | |||
+ | * Remove: | ||
+ | |||
+ | $ git rm | ||
+ | |||
+ | * See which files are modified since last commit: | ||
+ | |||
+ | $ git status | ||
+ | |||
+ | * Browse the history and see which files have been modified: | ||
+ | |||
+ | $ git log --stat | ||
+ | |||
+ | * See your modifications: | ||
+ | |||
+ | $ git diff | ||
+ | |||
+ | * Commit all uncommitted modifications: | ||
+ | |||
+ | $ git commit -a | ||
+ | |||
+ | * Commit a specific file: | ||
+ | |||
+ | $ git commit | ||
+ | |||
+ | * Publish your changes to upstream (svn commit): | ||
+ | |||
+ | $ git push | ||
+ | |||
+ |
how_to_work_with_git.txt · Last modified: 2017/10/02 15:20 by tsaue