Difference between revisions of "Git"
From Healthcare Robotics Wiki
Advaitjain (Talk | contribs) (→Create bare git repository on internal git server) |
Advaitjain (Talk | contribs) (→Alternate method to release code) |
||
| Line 22: | Line 22: | ||
#* this is the only branch that we should use from the internal server. | #* this is the only branch that we should use from the internal server. | ||
| − | |||
| − | |||
| − | |||
==== Clone from the internal server ==== | ==== Clone from the internal server ==== | ||
| Line 32: | Line 29: | ||
#* now you will see two branches (master and internal_hrl) | #* now you will see two branches (master and internal_hrl) | ||
#* usually Advait would expect people to work in the internal_hrl branch | #* usually Advait would expect people to work in the internal_hrl branch | ||
| + | |||
| + | === Add a remote branch to work directly with the google code repository === | ||
| + | # git remote add -f gt-ros-pkg.hrl_google_code https://code.google.com/p/gt-ros-pkg.hrl/ | ||
| + | # git checkout -b google_code_master gt-ros-pkg.hrl_google_code/master | ||
| + | |||
==== To release code ==== | ==== To release code ==== | ||
| − | # git checkout | + | # git checkout google_code_master |
# git checkout internal_hrl <path to files to release> | # git checkout internal_hrl <path to files to release> | ||
#* got this command from [http://jasonrudolph.com/blog/2009/02/25/git-tip-how-to-merge-specific-files-from-another-branch/ here] and [http://stackoverflow.com/questions/449541/how-do-you-merge-selective-files-with-git-merge here]. | #* got this command from [http://jasonrudolph.com/blog/2009/02/25/git-tip-how-to-merge-specific-files-from-another-branch/ here] and [http://stackoverflow.com/questions/449541/how-do-you-merge-selective-files-with-git-merge 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. | ||
# git commit -a | # git commit -a | ||
#* type in some descriptive release message. | #* type in some descriptive release message. | ||
| − | |||
| − | |||
# git checkout internal_hrl | # git checkout internal_hrl | ||
#* switch back to the internal_hrl branch | #* switch back to the internal_hrl branch | ||
Revision as of 17:12, 15 March 2012
Contents |
Local Clone of a Google Code Repository for Internal Use
Motivation
- 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.
Steps
Create bare git repository on internal git server
- ssh skynet.hsi.gatech.edu -lmycroft
- mkdir internal_git_bare
- cd internal_git_bare
- 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/ - Convert to a bare repository using steps from here:
- cd gt-ros-pkg.hrl/
- git config --bool core.bare true
- mv .git/ ../
- rm -rf *
- mv ../.git/ .
- create an internal_hrl branch:
git branch internal_hrl - change default branch to internal_hrl:
git symbolic-ref HEAD refs/heads/internal_hrl- this is the only branch that we should use from the internal server.
Clone from the internal server
- cd to whichever directory you want to keep your repo in. (e.g. cd ~/git)
- git clone mycroft@skynet.hsi.gatech.edu:/home/mycroft/internal_git_bare/gt-ros-pkg.hrl
- 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
- git remote add -f gt-ros-pkg.hrl_google_code https://code.google.com/p/gt-ros-pkg.hrl/
- git checkout -b google_code_master gt-ros-pkg.hrl_google_code/master
To release code
- git checkout google_code_master
- git checkout internal_hrl <path to files to release>
- git commit -a
- type in some descriptive release message.
- git checkout internal_hrl
- switch back to the internal_hrl branch
- ssh to skynet and push to google code.
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 these instructions.