git-tutorial
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
git-tutorial [2012/12/16 22:10] – smilauer | git-tutorial [2017/10/31 17:21] – oofem git repo updated to github bp | ||
---|---|---|---|
Line 40: | Line 40: | ||
If you want to get a copy of an existing Git repository — for example, a project you’d like to contribute to — the command you need is git clone. | If you want to get a copy of an existing Git repository — for example, a project you’d like to contribute to — the command you need is git clone. | ||
- | $ git clone http://www.oofem.org/git/ | + | $ git clone https://github.com/oofem/ |
Line 85: | Line 85: | ||
==== Viewing the Commit History ==== | ==== Viewing the Commit History ==== | ||
- | You can show the history of commits in the current branch using gil log command | + | You can show the history of commits in the current branch using git log command |
git log | git log | ||
Line 118: | Line 118: | ||
- | ====== Contributing to OOFEM - Practical | + | ====== Contributing to OOFEM - Practical |
Contributing to oofem project is different. Typically, you don’t have the permissions to directly update branches on the project reference repository and you have to pass your contribution(s) to the maintainers in some way. In OOFEM, these people (' | Contributing to oofem project is different. Typically, you don’t have the permissions to directly update branches on the project reference repository and you have to pass your contribution(s) to the maintainers in some way. In OOFEM, these people (' | ||
Line 126: | Line 126: | ||
Clone reference repository from remote server. This creates only '' | Clone reference repository from remote server. This creates only '' | ||
- | |||
$ git clone http:// | $ git clone http:// | ||
$ cd oofem.git | $ cd oofem.git | ||
Note: when a repository is cloned, git automatically creates a master branch that tracks origin/ | Note: when a repository is cloned, git automatically creates a master branch that tracks origin/ | ||
+ | |||
+ | If you already have oofem.git directory from a previous time, you can update '' | ||
+ | |||
+ | $ (git diff --name-only master origin/ | ||
+ | $ git checkout master | ||
+ | $ git pull --rebase | ||
Normally, we do not want to modify '' | Normally, we do not want to modify '' | ||
Line 136: | Line 141: | ||
$ (work) | $ (work) | ||
- | + | Locally modified files need to be uploaded to local server. Use option '' | |
- | Locally modified files need to be uploaded to local server. Use option '' | + | |
$ git commit -a | $ git commit -a | ||
Line 144: | Line 148: | ||
- | Now, while you are working hard on your new feature, other developers complete theirs and push their changes to the remote | + | Now, while you are working hard on your new feature, other developers complete theirs and push their changes to the remote |
$ git checkout master | $ git checkout master | ||
$ git pull --rebase | $ git pull --rebase | ||
| | ||
- | Now, to make merging your code easy, you should rebase your //featureA//. What this does is add all the commits you just pulled in to your //featureA//. Any conflicts that arise will happen in your //featureA// as well, leaving your master branch clean and in order. | + | Now, to make merging your code easy, you should rebase your '' |
$ git checkout featureA | $ git checkout featureA | ||
Line 158: | Line 162: | ||
** | ** | ||
- | Optionally, your branch can be merged into simgle //master// on a local machine and //featureA// can be deleted | + | Optionally, your branch can be merged into single '' |
$ git checkout master | $ git checkout master |
git-tutorial.txt · Last modified: 2017/11/01 09:08 by bp