Difference between revisions of "Git"

From Healthcare Robotics Wiki
Jump to: navigation, search
(To release code)
(Old stuff)
Line 61: Line 61:
# git checkout internal_hrl
# git checkout internal_hrl
# git merge google_code_master
# git merge google_code_master
=== Getting a single folder from svn ===
* clone just that folder into a separate git repository.
* then merge this new git repository into gt-ros-pkg.hrl using [http://jasonkarns.com/blog/merge-two-git-repositories-into-one/ these instructions].

Revision as of 15:22, 16 March 2012

Local Clone of a Google Code Repository for Internal Use


  • Advait thinks it might be good for people in lab to be able to push to and pull from a non-google computer that has a clone of gt-ros-pkg
  • The goal would be to use this as an internal git repository with the option of pushing to gt-ros-pkg hosted on google.com when code is ready to be publicly downloadable.

Create bare git repository on internal git server

  1. ssh skynet.hsi.gatech.edu -lmycroft
  2. mkdir internal_git_bare
  3. cd internal_git_bare
  4. Clone gt-ros-pkg with advait as the user on skynet.hsi.gatech.edu:
    git clone https://advaitjain@code.google.com/p/gt-ros-pkg.hrl/
  5. Convert to a bare repository using steps from here:
    1. cd gt-ros-pkg.hrl/
    2. git config --bool core.bare true
    3. rm -rf *
    4. ls -la
      • you should see a .git
  6. git branch -m master internal_hrl
    • rename master to internal_hrl

Steps on each client machine

Clone from the internal server

  1. cd to whichever directory you want to keep your repo in. (e.g. cd ~/git)
  2. git clone mycroft@skynet.hsi.gatech.edu:/home/mycroft/internal_git_bare/gt-ros-pkg.hrl
  3. git checkout --track origin/internal_hrl
    • now you will see two branches (master and internal_hrl)
    • usually Advait would expect people to work in the internal_hrl branch

Add a remote branch to work directly with the google code repository

  1. git remote add -f gt-ros-pkg.hrl_google_code https://code.google.com/p/gt-ros-pkg.hrl/
  2. git checkout -b google_code_master gt-ros-pkg.hrl_google_code/master

To release code

  1. create an appropriately named release branch.
  2. push that release branch to the internal server.
  3. create a new git repository on gt-ros-pkg for the stack to be released.
  4. clone this gt-ros-pkg repository to your computer.
  5. add internal repository as a remote branch on your computer's clone of gt-ros-pkg repo:
    git remote add -f <release_stack_name> mycroft@skynet.hsi.gatech.edu:/home/mycroft/internal_git_bare/<release_stack_name>
  6. perform a merge:
    git merge <release_stack_name>/<release_branch>
  7. optionally reset the history:
    git reset --soft HEAD^
  8. git commit -a
    • put in an appropriate release message.

Old stuff

  1. git checkout google_code_master
  2. git checkout internal_hrl <path to files to release>
    • got this command from here and here.
    • this will get the files that we want to release, but the history will not be available in the public repository. It will still be available in the internal repository.
  3. git commit -a
    • type in some descriptive release message.
  4. git checkout internal_hrl
    • switch back to the internal_hrl branch
  5. ssh to skynet and push to google code.

To get changes from google code repository

Merge the changes in the google_code_master branch with the internal_hrl branch

  1. git checkout google_code_master
  2. git pull
  3. git checkout internal_hrl
  4. git merge google_code_master