Tuesday, August 23, 2011

Collaborative Writing with Git

Starting a new repository using github:

1) Go to github.com, create an account and start a new remote repository. We will create the project name HPCA2012.

2) Go to the directory of your project and start a local git repository:
>>cd HPCA2012
>>git init
>>git add .
>>git commit -m "My first commit"

3) Now add the remote repository as the origin:
>>git remote add origin git@github.com:gbezerra/HPCA2012

4) Push the changes to the remote repository:
>>git push -u origin master

Contributing to a shared repository:

1) create a local copy of the repository using git clone:
>> mkdir HPCA2012
>> cd HPCA2012
>> git clone git@github.com:gbezerra/HPCA2012 .

2) Add the remote repository to your list of remotes. Its shortcut name will be origin.
>> git remote add origin git@github.com:gbezerra/HPCA2012
Now you can use the name "origin" to refer to the remote repo.

3) Modify the files, in this case file hpca2012.tex, and commit your changes.
git commit -a -m "your commit message"

4) Merge and solve conflicts:
>>git pull

5) Share:
>> git push origin master

Whenever you want to update your local repo with the latest changes just use
>>git pull
To check the status of your repository use
>> git status
Once your repository is setup you'll only need steps 3 to 5 in your workflow.

Good luck!

No comments:

Post a Comment