User:Timothee Flutre/Notebook/Postdoc/2012/08/14: Difference between revisions
From OpenWetWare
(→Entry title: first version) |
(→About Git: add links and help) |
||
Line 8: | Line 8: | ||
==About Git== | ==About Git== | ||
* '''Motivation''': nowadays, it's pretty common to use a computer for a project in which one wants to: keep history of the changes, access them on different operating | * '''Motivation''': nowadays, it's pretty common to use a computer for a project in which one wants to: keep history of the changes, access them on different machines with different operating systems, share our work with someone else, etc. In such cases, it's very useful to use a distributed versioning system, such as [http://en.wikipedia.org/wiki/Git_%28software%29 Git]. | ||
* '''Start using git''': first you need to [http://git-scm.com/downloads download] it. Then you need to read some [http://git-scm.com/doc documentation] about it. And finally you can start using it. Typical cases are when developing a software or writing an article. | |||
* '''Need some help''': the learning curve for git is quite steep at the beginning, so it's always worth browsing [https://help.github.com/ help pages], reading [http://gitref.org/ Git Reference], and searching for questions and answers on [http://stackoverflow.com/ stackoverflow]. | |||
* '''Writing a paper''': in this example, I am writing a paper with two colleagues. We decide to do it as a [http://git-scm.com/book/en/Distributed-Git-Distributed-Workflows centralized workflow], the shared repository being hosted by [https://github.com/ github]. | * '''Writing a paper''': in this example, I am writing a paper with two colleagues. We decide to do it as a [http://git-scm.com/book/en/Distributed-Git-Distributed-Workflows centralized workflow], the shared repository being hosted by [https://github.com/ github]. | ||
Line 15: | Line 22: | ||
** I create a private repository named "paper" and add my colleagues as collaborators to it. | ** I create a private repository named "paper" and add my colleagues as collaborators to it. | ||
** I retrieve the repository on my local machine: <code>git clone git://github.com/timflutre/paper.git</code> | ** I retrieve the repository on my local machine: <code>git clone git://github.com/timflutre/paper.git</code> | ||
** I create | ** I create my first file, for instance "paper_main.tex", and add it to git in my local repository: <code>git add paper_main.tex</code> followed by <code>git commit -m "first commit" paper_main.tex</code>. | ||
** I create one branch per collaborator (the default branch being "master"): <code>git branch tim</code>, then <code>git branch colleague1</code> and finally <code>git branch colleague2</code>. I can list the local branches with <code>git branch</code> and I can switch to my branch with <code>git checkout tim</code> for instance. | ** I create one branch per collaborator (the default branch being "master"): <code>git branch tim</code>, then <code>git branch colleague1</code> and finally <code>git branch colleague2</code>. I can list the local branches with <code>git branch</code> and I can switch to my branch with <code>git checkout tim</code> for instance. | ||
** I push the changes I made from my local repo onto github: <code>git push origin master</code>, this for each branch I created. | ** I push the changes I made from my local repo onto github: <code>git push origin master</code>, this for each branch I created. | ||
** I send an email to my colleagues telling them that they can retrieve the content of the repository from github into their local machine(s): <code>git clone | ** I send an email to my colleagues telling them that they can retrieve the content of the repository from github into their local machine(s): <code>git clone https://github.com/timflutre/paper.git</code>. | ||
** Each of us can make modifications on its own branch, and push them on github in order to allow the others to access the changes. | ** Each of us can make modifications on its own branch, and push them on github in order to allow the others to access the changes. | ||
** From time to time, one of us has the responsibility to merge the changes and update the "master" branch with the latest version. | ** From time to time, one of us has the responsibility to merge the changes and update the "master" branch with the latest version. |
Revision as of 12:29, 15 August 2012
Project name | <html><img src="/images/9/94/Report.png" border="0" /></html> Main project page <html><img src="/images/c/c3/Resultset_previous.png" border="0" /></html>Previous entry<html> </html>Next entry<html><img src="/images/5/5c/Resultset_next.png" border="0" /></html> |
About Git
|