Using Git

From Bio++ Wiki
Revision as of 11:09, 17 September 2014 by Julien (talk | contribs) (Branching)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Git small howto

This is a small note for developpers. Bio++ is now using git as its versioning system. There are a lot of tutorials on the web dedicated to the use of git. Here are some very basic features:

Get a copy of the source code from the central repository: <source lang="bash"> git clone </source>

To view the status of your local repository, do, when you are in the directory bpp-XXX:

<source lang="bash"> git status </source>

In order to update your local repository from the central one, you need to type: <source lang="bash"> git pull </source>

To check the modifications done to a file: <source lang="bash"> git diff myfile </source>

Before commiting a file, you need to add this file to the commit-list: <source lang="bash"> git add myfile </source>

and then commit it: <source lang="bash"> git commit </source>

Compared to CVS or SVN, commits are local. If you want to send your modifications to the central directory, you of course need an ssh access on the server, and then: <source lang="bash"> git push </source> BEFORE doing this, you will have to tell a bit more about yourself by setting (only once): <source lang="bash"> git config --global "Your Name Comes Here" git config --global </source> AND you will always have to pull before pushing!


Create a new local branch: <source lang="bash"> git checkout -b testbranch </source>

Switch back to master branch: <source lang="bash"> git checkout master </source>

List all branches: <source lang="bash"> git branch </source>

Push a branch to a remote location: <source lang="bash"> git push -u origin testbranch </source>

Delete a branch: <source lang="bash"> git branch -d testbranch </source>

Delete a branch from a remote location: <source lang="bash"> git push origin --delete testbranch </source>