User Tools

Site Tools


git-tutorial

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
git-tutorial [2012/12/16 22:11] smilauergit-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/oofem.git oofem.git+   $ git clone https://github.com/oofem/oofem.git
  
  
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 Workflow ======+====== Contributing to OOFEM - Practical workflow ======
 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 ('lieutenants') are in charge of a specific subsystem of the project and they merge in all changes related to that subsystem and push them to the reference (blessed) repository that everyone can clone from again. In general, lieutenants prefer to accept contributed patches via e-mail. 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 ('lieutenants') are in charge of a specific subsystem of the project and they merge in all changes related to that subsystem and push them to the reference (blessed) repository that everyone can clone from again. In general, lieutenants prefer to accept contributed patches via e-mail.
  
Line 126: Line 126:
  
 Clone reference repository from remote server. This creates only ''master'' branch in you local machine. 'oofem.git' is an arbitrary name of directory. Clone reference repository from remote server. This creates only ''master'' branch in you local machine. 'oofem.git' is an arbitrary name of directory.
- 
   $ git clone http://www.oofem.org/git/oofem.git oofem.git   $ git clone http://www.oofem.org/git/oofem.git oofem.git
   $ cd oofem.git   $ cd oofem.git
  
 Note: when a repository is cloned, git automatically creates a master branch that tracks origin/master branch, but there is no automatic update (need to use "pull" command) Note: when a repository is cloned, git automatically creates a master branch that tracks origin/master branch, but there is no automatic update (need to use "pull" command)
 +
 +If you already have oofem.git directory from a previous time, you can update ''master'' branch.
 +
 +   $ (git diff --name-only master origin/master   or   $git diff master origin/master)  //see the differences between local and remote masters
 +   $ git checkout master
 +   $ git pull --rebase
  
 Normally, we do not want to modify ''master'' branch directly. For this reason, we create a new brach ''featureA'' for our development, which is a copy from an active previous branch ''master'' Normally, we do not want to modify ''master'' branch directly. For this reason, we create a new brach ''featureA'' for our development, which is a copy from an active previous branch ''master''
Line 136: Line 141:
   $ (work)   $ (work)
  
- +Locally modified files need to be uploaded to local server. Use option ''-a'' to upload all changed files which were included in the local repository. A message required on commiting will go also to a remote server.
-Locally modified files need to be uploaded to local server. Use option ''-a'' to upload all changed files which were included in the local repository.+
  
   $ git commit -a   $ git commit -a
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 ''master'' on a local machine and ''featureA'' can be deleted
  
   $ git checkout master   $ git checkout master
git-tutorial.txt · Last modified: 2017/11/01 09:08 by bp