Difference between revisions of "Git"
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
| Line 1: | Line 1: | ||
| − | =  | + | =Setting up a new DHS repo based on a TOL repo=  | 
| − | |||
| − | |||
| − | |||
| − | |||
* on dssysdev02  | * on dssysdev02  | ||
| − | + |  REPONAME=centos-netinstall-dws.git  | |
| − | + |  git clone --bare http://git.ops.traderonline.com/${REPONAME} /path/to/${REPONAME}  | |
| − | + |  cd /path/to/${REPONAME}  | |
| − | + |  git remote rm origin  | |
| + |  git update-server-info  | ||
| + |  mv hooks/post-update.sample hooks/post-update  | ||
* on laptop  | * on laptop  | ||
| − | + |  REPONAME=centos-netinstall-dws.git  | |
| − | + |  git clone ssh://root@git.dhsint.com/path/to/${REPONAME}  | |
| − | + | ||
| − | + | =Making changes to files=  | |
| − | + |  BRANCHNAME=set-default-options  | |
| − | + |  git checkout -b ${BRANCHNAME}  | |
| + |  # Make changes  | ||
| + |  git add <edited file(s)>  | ||
| + |  git commit    | ||
| + |  git push origin ${BRANCHNAME}:${BRANCHNAME}  | ||
| + | |||
=Overwriting updates to a branch=  | =Overwriting updates to a branch=  | ||
| − | + |  BRANCHNAME=set-default-options  | |
| − | + |  git add <edited file>  | |
| − | + |  git commit --amend  | |
| + |  git push origin +${BRANCHNAME}:${BRANCHNAME}  | ||
| + | |||
=Merge My Edits=  | =Merge My Edits=  | ||
| − | + |  BRANCHNAME=set-default-options  | |
| − | + |  git checkout master  | |
| − | + |  git merge --no-ff ${BRANCHNAME}  | |
| − | + |  git push origin master:master  | |
| − | Once that is complete, delete the branch  | + |  # Once that is complete, delete the branch  | 
| − | + |  git push origin :${BRANCHNAME}  | |
| − | + |  git branch -d ${BRANCHNAME}  | |
=Merging Someone Else's Edits=  | =Merging Someone Else's Edits=  | ||
| − | + |  REMOTENAME=tol  | |
| − | + |  BRANCHNAME=set-default-options  | |
| − | + |  git checkout master  | |
| − | + |  git rev-parse HEAD  | |
| + |  git merge-base HEAD ${REMOTENAME}/${BRANCHNAME}  | ||
| + |  git merge --no-ff ${REMOTENAME}/${BRANCHNAME}  | ||
| + |  git push origin master:master  | ||
Revision as of 06:22, 18 August 2011
Setting up a new DHS repo based on a TOL repo
- on dssysdev02
 
REPONAME=centos-netinstall-dws.git git clone --bare http://git.ops.traderonline.com/${REPONAME} /path/to/${REPONAME} cd /path/to/${REPONAME} git remote rm origin git update-server-info mv hooks/post-update.sample hooks/post-update
- on laptop
 
REPONAME=centos-netinstall-dws.git git clone ssh://root@git.dhsint.com/path/to/${REPONAME}
Making changes to files
BRANCHNAME=set-default-options
git checkout -b ${BRANCHNAME}
# Make changes
git add <edited file(s)>
git commit 
git push origin ${BRANCHNAME}:${BRANCHNAME}
Overwriting updates to a branch
BRANCHNAME=set-default-options
git add <edited file>
git commit --amend
git push origin +${BRANCHNAME}:${BRANCHNAME}
Merge My Edits
BRANCHNAME=set-default-options
git checkout master
git merge --no-ff ${BRANCHNAME}
git push origin master:master
# Once that is complete, delete the branch
git push origin :${BRANCHNAME}
git branch -d ${BRANCHNAME}
Merging Someone Else's Edits
REMOTENAME=tol
BRANCHNAME=set-default-options
git checkout master
git rev-parse HEAD
git merge-base HEAD ${REMOTENAME}/${BRANCHNAME}
git merge --no-ff ${REMOTENAME}/${BRANCHNAME}
git push origin master:master