Text-based Collaboration in Scientific Projects
Improving Workflows with Distributed Version Control
~/.hgrc
)
[ui] username = Gerald Senarclens de Grancy <oss@senarclens.eu> editor = jed [extensions] fetch = color =
hg help hg init # create files (C1) hg add hg ci -m 'initial ci' # change content of b, add new files (C2) hg st hg diff hg add hg ci -m 'updated b' # change content of c (C3) hg ci -m 'updated c' hg log hg id hg up 1 # check content of c; create d (C4) hg ci -m 'creating branch' hg merge hg ci -m 'merged branches' hg serve
~/.gitconfig
)
git config --global user.name "Gerald Senarclens de Grancy" git config --global user.email "oss@senarclens.eu" git config --global color.ui auto git config --global core.editor jed git config --global -e # show/ edit config file
git init # create files git status git add . git diff # between working tree and index git diff --staged # between index and repository git status git commit -m 'initial ci' git show # change content of file, add new files git status git diff git add . git commit -m 'updated b' # change content of file f git commit -a -m 'updated f' git log git gui blame ${FILENAME} git pull --rebase git push # [<repository>] [[local_branch] remote_branch]
export PS1='\@ \033[1m[\u@\h] $(__git_ps1 "git:%s")\033[0m\n\w >'
## GIT ######################### # these need to be set before PS1 export GIT_PS1_SHOWDIRTYSTATE=1 export GIT_PS1_SHOWSTASHSTATE=1 export GIT_PS1_SHOWUNTRACKEDFILES=1 export GIT_PS1_SHOWUPSTREAM="auto verbose"
.gitignore
.hgignore
git config --global merge.tool kdiff3
git branch new-feature # create branch git branch # list branches # edit files git commit -a # commit to original branch git checkout new-feature # switch to new branch # create and edit files git add . git commit # commit to new branch # create and edit more files git add . git commit # commit to new branch git checkout master # switch to master git merge new-feature # merge new-feature into master git mergetool [-t <tool>] # if conflicts occurred git log gitk --all
ssh-add