Difference between revisions of "Yade on github"

From Yade

Line 26: Line 26:
 
git fetch upstream
 
git fetch upstream
   
=== Committing changes ===
+
=== Committing and updating ===
   
 
''Note for bazaar users: the commit mechanisms in Git significantly differs from that of Bazaar or SVN. Therefore, don't expect to find a one-to-one command replacement. In some cases, however, the equivalent bazaar command is indicated below to ease the transition.
 
''Note for bazaar users: the commit mechanisms in Git significantly differs from that of Bazaar or SVN. Therefore, don't expect to find a one-to-one command replacement. In some cases, however, the equivalent bazaar command is indicated below to ease the transition.
 
''
 
''
  +
  +
==== Inspecting changes ====
   
 
You may start by inspecting your changes with a few commands. For the "diff" command, it is convenient to copy from the output of "status" instead of typing the path to modified files.
 
You may start by inspecting your changes with a few commands. For the "diff" command, it is convenient to copy from the output of "status" instead of typing the path to modified files.
 
git status
 
git status
 
git diff path/to/modified/file.cpp
 
git diff path/to/modified/file.cpp
  +
  +
==== Committing changes ====
   
 
Then you proceed to commit:
 
Then you proceed to commit:
   
git add path/to/modified/file.cpp #Adds all newly created files, if any (equivalent of "bzr add")
+
git add path/to/new/file.cpp #Version a newly created file (equivalent of "bzr add"), or
  +
git add . #Version all newly created files
git commit -am'Commit message' #It can be done several times after every sufficient change (no equivalent in bzr, it's like commiting to your own local repository)
 
git push origin master #Push you changes into a server (equivalent of "bzr commit", except that your are commiting to your own remote branch)
+
git commit path/to/new_or_modified/file.cpp -am'Commit message' #Validate a change. It can be done several times after every sufficient change (no equivalent in bzr, it's like commiting to your own local repository), or
  +
git commit -am'Commit message' #Same as above but select all changes at once
 
  +
git push origin master #Push your changes into gitHub (equivalent of "bzr commit", except that your are commiting to your own remote branch)
You may want to get changes done by others:
 
 
git fetch upstream #Pull new updates from the upstream (eq. of "bzr update")
 
git merge upstream/master #Merge upstream changes into your master-branch (eq. of "bzr update", but it actually updates your remote branch instead of your local repository)
 
   
 
Changes will be pushed to your personal "fork", If you have tested your changes and you are ready
 
Changes will be pushed to your personal "fork", If you have tested your changes and you are ready
Line 50: Line 51:
   
 
When the pull request has been reviewed and accepted, your changes are integrated in the main trunk. Everyone will get them via "git fetch" or "git merge".
 
When the pull request has been reviewed and accepted, your changes are integrated in the main trunk. Everyone will get them via "git fetch" or "git merge".
  +
  +
==== Updating ====
 
You may want to get changes done by others:
  +
 
git fetch upstream #Pull new updates from the upstream (eq. of "bzr update")
 
git merge upstream/master #Merge upstream changes into your master-branch (eq. of "bzr update", but it actually updates your remote branch instead of your local repository)

Revision as of 17:22, 30 March 2012

Using yade on GitHub

Most usefull commands are below. For more details, see for instance http://gitref.org/index.html


Setup

1. Register on github.com

2. Add your SSH key to GitHub[1]:

 On the GitHub site Click “Account Settings” > Click “SSH Public Keys” > Click “Add another public key”

3. Set your username and email:

 git config --global user.name "Firstname Lastname"
 git config --global user.email "your_email@youremail.com"

4. Fork A Repo[2]:

 click the “Fork” button on the https://github.com/yade/trunk

5. Set Up Your Local Repo:

 git clone git@github.com:username/trunk.git
 

6. Configure remotes:

 cd to/newly/created/folder
 git remote add upstream git@github.com:yade/trunk.git
 git fetch upstream

Committing and updating

Note for bazaar users: the commit mechanisms in Git significantly differs from that of Bazaar or SVN. Therefore, don't expect to find a one-to-one command replacement. In some cases, however, the equivalent bazaar command is indicated below to ease the transition.

Inspecting changes

You may start by inspecting your changes with a few commands. For the "diff" command, it is convenient to copy from the output of "status" instead of typing the path to modified files.

git status
git diff path/to/modified/file.cpp

Committing changes

Then you proceed to commit:

git add path/to/new/file.cpp   #Version a newly created file (equivalent of "bzr add"), or
git add .                      #Version all newly created files
git commit path/to/new_or_modified/file.cpp -am'Commit message'      #Validate a change. It can be done several times after every sufficient change (no equivalent in bzr, it's like commiting to your own local repository), or
git commit -am'Commit message'      #Same as above but select all changes at once
git push origin master              #Push your changes into gitHub (equivalent of "bzr commit", except that your are commiting to your own remote branch)

Changes will be pushed to your personal "fork", If you have tested your changes and you are ready to push them into the main trunk, just do a "pull request" [3]. After reviewing your changes they will be added to the main trunk.

When the pull request has been reviewed and accepted, your changes are integrated in the main trunk. Everyone will get them via "git fetch" or "git merge".

Updating

You may want to get changes done by others:

git fetch upstream                  #Pull new updates from the upstream (eq. of "bzr update") 
git merge upstream/master           #Merge upstream changes into your master-branch (eq. of "bzr update", but it actually updates your remote branch instead of your local repository)