Difference between revisions of "GIT"

From DaqWiki
Jump to navigation Jump to search
Line 64: Line 64:
 
   233  17:23  mv post-update.sample post-update
 
   233  17:23  mv post-update.sample post-update
 
   234  17:24  chmod a+x ./post-update
 
   234  17:24  chmod a+x ./post-update
  240  17:25  git fetch
 
  241  17:25  git tag -l
 
  242  17:25  git branch
 
  244  17:32  git update-server-info
 
 
</pre>
 
</pre>
 +
 +
Additional commands:
 +
* fetch latest version: cd root.git; git fetch; git update-server-info
 +
* list all version tags: cd root.git; git tag -l
 +
* list all version branches: cd root.git; git branch
  
 
=== Wisdom from ROOT ===
 
=== Wisdom from ROOT ===

Revision as of 10:05, 4 July 2013

GIT NOTES

Create personal "cloneable" repository

This uses the "dual" repository method: the first repository is a bare repository is exported to the world via httpd, the second repository is where all work is done, committed. When ready, the work repository is pushed to the bare repository and becomes visible to the world.

$ cd ~/public_html/git
$ git init --bare rpms.git
Initialized empty Git repository in /home/olchansk/public_html/git/rpms.git/
$ cd rpms/hooks
$ mv post-update.sample post-update
$ chmod a+x ./post-update 
$ cd ~/git/
$ git clone ~/public_html/git/rpms.git rpms
warning: You appear to have cloned an empty repository.
$ cd rpms
$ date > test
$ git add test
$ git commit -m"test"
[master (root-commit) 9236a84] test
$ git push origin master
To /home/olchansk/public_html/git/rpms.git
 * [new branch]      master -> master
$ rm test
$ date > test 
$ git add test
$ git commit -m"test"
[master 54a6b4e] test
$ git push
To /home/olchansk/public_html/git/rpms.git
   9236a84..54a6b4e  master -> master
$ ssh to somewhere else
$ git clone http://ladd00.triumf.ca/~olchansk/git/rpms.git rpms

Merge history from another git repository

$ git fetch file:///home/olchansk/sysadm/rpm/diskscrub/ master:diskscrub_merge
$ git checkout master:diskscrub_merge
$ mkdir diskscrub
$ git add diskscrub
$ git mv *.* diskscrub
$ ls -la
$ git status
$ git commit -m"move into subdirectory" -a
$ git checkout master
$ ls -la
$ git merge diskscrub_merge
$ git log --graph
$ git log --graph --oneline
$ git push

Setup mirror of the ROOT git repository

ssh daqweb@ladd00
   204  16:53   cd public_html/
   206  16:54   cd git/
   221  17:04   git clone --bare http://root.cern.ch/git/root.git root.git
   231  17:23   cd root.git/hooks/
   233  17:23   mv post-update.sample post-update
   234  17:24   chmod a+x ./post-update

Additional commands:

  • fetch latest version: cd root.git; git fetch; git update-server-info
  • list all version tags: cd root.git; git tag -l
  • list all version branches: cd root.git; git branch

Wisdom from ROOT