Tags:
create new tag
view all tags

Informal HEP Git Repository

This is a guide to use the informal git repository at HEP-GC

Git on fate-2

Creating a Shared Repository

To create a shared repository on fate-2, first log in as the git user with your ssh key, then create a directory and initialize a repository in it.

user@fate-2 $ ssh git@fate-2.phys.uvic.ca -p 2200
git@fate-2 $ mkdir newrepo.git
git@fate-2 $ cd newrepo.git
git@fate-2 $ git --bare init --shared
git@fate-2 $ exit

Now as your regular user, create a local copy of your repo and commit your first file:

user@fate-2 $ git clone ~git/newrepo.git
user@fate-2 $ cd newrepo
user@fate-2 $ echo This is my new git repo > README
user@fate-2 $ git add README
user@fate-2 $ git commit -m "This is my first commit"

Now we'll link our remote repository, and our local repository, then push our first commit to the master branch.

user@fate-2 $ git remote add origin ~git/newrepo.git
user@fate-2 $ git push origin master

Now we're done!

Typical workflow on fate-2

First, we clone our git repo

user@fate-2 $ git clone ~git/newrepo.git
user@fate-2 $ cd newrepo

Now we'll create a new file, and push it back to the main repo.

user@fate-2 $ echo lalalal this is a file > newfile
user@fate-2 $ ls
newfile README
user@fate-2 $ git add newfile
user@fate-2 $ git commit -m "Added a newfile"
user@fate-2 $ git push

Done.

Github

Github is a free git hosting service, used by Nimbus, Rails and others. We use it too.

Sign up for an account at github, and check out the repository at http://github.com/oldpatricka/HEP-GC-CANFAR .

Cloning the repository

If you're a contributor, try this out:

$ git clone git@github.com:oldpatricka/HEP-GC-CANFAR.git

If not, this:

$ git://github.com/oldpatricka/HEP-GC-CANFAR.git

Checking out a remote branch, and merging it with a local branch

$ git branch newstuff origin/newstuff
$ git checkout newstuff

Great this new stuff looks pretty interesting, let's merge it back to the local master branch:

$ git checkout master
$ git merge newstuff

Let's push it back to the repo

$ git push origin master

But say we want to push to a different remote branch? First, checkout the remote branch as local, merge the two, push back:

$ git branch dev origin/dev
$ git checkout dev
$ git merge newstuff
$ git push origin dev

-- PatrickArmstrong - 2009-08-06

Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | More topic actions
Topic revision: r6 - 2009-10-06 - patricka
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback