-
Notifications
You must be signed in to change notification settings - Fork 2
Version control with git (github)
variani edited this page Apr 14, 2015
·
7 revisions
Workflow and project organization
- Blog post A successful Git branching model
- Tutorial Git Workflows
Git scripts and tools
- https://help.github.com/articles/caching-your-github-password-in-git/
- https://help.github.com/articles/remembering-your-github-username-or-email/
- creating folders on github.com without using git: typing the path with slashes like "/".
References
Configuration
git clone https://github.com/username/Hello-World.git # local repository will be named *origin*.
In clone's default setup, the default local branch tracks the origin remote, which represents the default branch in the remote repository.
update via stackoveflow.com
# svn update
git pull
An equivalent of "svn update" would be "git pull --rebase". Also please remember that you can do "git fetch" separately from the "git merge" part of "git pull".
Commit
git add README
git commit -m 'first commit'
git push origin master
git clone -b gh-pages --single-branch https://github.com/variani/thesis.git thesis-gh-pages
> $ git pull
You asked me to pull without telling me which branch you
want to merge with, and 'branch.gh-pages.merge' in
your configuration file does not tell me, either. Please
specify which branch you want to use on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.
Notes: https://github.com/regebro/die-git-die.
Solution: edit .gitconfig
file
[push]
default = current
[branch "gh-pages"]
remote = origin
merge = refs/heads/gh-pages
rebase = true
# fork the repo on github.com
# clone
git clone https://github.com/variani/lme4.git
# configure the local repo to keep track on the original repo
git remote add upstream https://github.com/lme4/lme4.git
git fetch upstream
git branch -a
# change code to `upstream/flexLambda`
git checkout upstream/flexLambda
# create a local branch with the same name `origin/flexLambda`
# - this new branch will be syncronized with `upstream/flexLambda`
git checkout -b flexLambda upstream/flexLambda
# create another local branch `origin/flexLambda-dev` with a starting point `origin/flexLambda`
git checkout -b flexLambda-dev flexLambda
# add and push changes
touch R/flexLambda.R
git add R/flexLambda.R
git commit -m 'first change'
git push origin flexLambda-dev
# pull
git pull origin flexLambda-dev