git-tutorial
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
git-tutorial [2012/11/03 23:05] – smilauer | git-tutorial [2017/11/01 09:08] (current) – bp | ||
---|---|---|---|
Line 18: | Line 18: | ||
git config --global user.email " | git config --global user.email " | ||
- | ====== Git Basics ====== | + | ====== Git Basics |
Our two main branches are: | Our two main branches are: | ||
master | master | ||
- | | + | |
- | The master branch is stable | + | The master branch is used to our development, |
==== Local and remote repositories ==== | ==== Local and remote repositories ==== | ||
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 57: | Line 57: | ||
git commit -m "your commit message" | git commit -m "your commit message" | ||
| | ||
- | The commit does not go to a remote server (oofem.org) - this is the major difference with svn. For those, who have write access to remote server, '' | + | The commit does not go to a remote server (oofem.org) - this is the major difference with svn. |
==== Viewing Your Staged and Unstaged Changes ==== | ==== Viewing Your Staged and Unstaged Changes ==== | ||
Line 74: | Line 74: | ||
# | # | ||
- | ==== Committing Your Changes ==== | + | ==== Committing Your Changes |
When the staging area is set up, you can commit your changes to local repository. Please note, that anything that is still unstaged — any files you have created or modified won’t go into this commit. They will stay as modified files on your disk. The simplest way to commit is to type git commit: | When the staging area is set up, you can commit your changes to local repository. Please note, that anything that is still unstaged — any files you have created or modified won’t go into this commit. They will stay as modified files on your disk. The simplest way to commit is to type git commit: | ||
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 102: | Line 102: | ||
To track remote branch, for example the develop branch on origin, use | To track remote branch, for example the develop branch on origin, use | ||
- | $ git checkout -b develop | + | $ git checkout -b stable |
If you have Git version 1.6.2 or later, you can also use the --track shorthand: | If you have Git version 1.6.2 or later, you can also use the --track shorthand: | ||
- | $ git checkout --track origin/develop | + | $ git checkout --track origin/stable |
You can switch between branches using git checkout < | You can switch between branches using git checkout < | ||
- | $ git checkout | + | $ git checkout |
- | If you now call git branch, you will see that a new branch named newfeature | + | If you now call git branch, you will see that a new branch named stable |
$ git branch | $ git branch | ||
master | master | ||
- | * develop | + | * stable |
| | ||
To synchronize your work, you run | To synchronize your work, you run | ||
Line 118: | Line 118: | ||
- | ====== Contributing to OOFEM ====== | + | ====== Contributing to OOFEM - Practical workflow |
- | Contributing | + | For people without write permissions |
- | **Before contributing, | + | You can read more about [[https:// |
- | First, you’ll probably want to clone the main repository, create | + | Typically, one have to create a fork, or copy, of the repository. Forks let you make changes to a project without affecting |
+ | * Read more about [[https:// | ||
+ | * [[https:// | ||
- | # Clone reference | + | If you have write access to the repository, you can also create branch directly within oofem repository. This should be reserved |
- | | + | |
- | $ cd oofem.git | + | |
- | # We need also '' | + | |
- | $ git checkout -b develop origin/develop | + | |
- | # Normally, we do not want to modify '' | + | |
- | $ git checkout -b featureA | + | |
- | $ (work) | + | |
- | $ git commit | + | |
- | $ (work) | + | |
- | $ git commit | + | |
- | :!: **It is stronlgly recommended to use '' | ||
- | ** | ||
- | Now you have your commits that you want to send to the maintainers. You use git format-patch to generate the mbox-formatted files that you can e-mail — it turns each commit into an e-mail message with the first line of the commit message as the subject | + | After you have created a pull request, |
+ | In OOFEM, these people (' | ||
- | $ git format-patch -M origin/ | + | **Before contributing, please make sure you have followed [[coding-conventions|oofem coding conventions]].** |
- | 0001-add-limit-to-log-function.patch | + | |
- | 0002-changed-log-output-to-30-from-25.patch | + | |
- | + | ||
- | The format-patch command prints out the names of the patch files it creates. The -M switch tells Git to look for renames. | + | |
- | To e-mail this to a maintainers, you can either paste the file into your e-mail program or send it via a command-line program. | + | |
- | ===== Maintainers ===== | ||
- | FIXME Here it would be nice to mention all lieutenants, | ||
- | |||
====== Links ====== | ====== Links ====== | ||
- | * Online version of [[http://git-scm.com/book|Git book]]. Higly recommended! | + | * Online version of [[https://help.github.com/|GitHub help]]. Higly recommended! |
- | * Git-SVN | + | * Online version of [[http:// |
git-tutorial.1351980313.txt.gz · Last modified: 2012/11/03 23:05 by smilauer