linux: git config credential.helper ‘cache –timeout=3600000’
windows: git config credential.helper winstore
git config –global credential.helper wincred
https://github.com/anurse/git-credential-winstore/downloads
git config –global credential.helper store
it config –unset credential.helper
git config -l
http://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server
git ls-files -o -i –exclude-standard
git review:
git push gerrit HEAD:refs/for/master
git commit –amend –author “Shock Jiang <shock.jiang@gmail.com>”
#remove file in the repository but keep local copy
git rm –cached shock-rsp/abc
git push remote localbranch:remotebranch
git push -f remote localbranch:remotebranch
git reset –hard remote/branch
git diff HEAD~1
git diff HEAD~1 main.tex
#check pull/push
git remote -v
#remove file from last commit
git reset HEAD~1 — FILE
git checkout FILE
git commit –amend
git rm doc/\*.txt #recursive remove all *.txt under doc
git branch -vv
git push -u origin new_branch
git branch -u origin/foo foo
git branch –set-upstream my_branch origin/my_branch
#replace origin with new url
git remote set-url origin https://github.com/USERNAME/OTHERREPOSITORY.git
git push -u origin master
git remote set-url origin http://git.oschina.net/shockjiang/shock-data
remove a branch:
git branch -D <name-of-branch>
git branch -D -r origin/<name-of-branch>
git push origin :<name-of-branch>
#on server’s computer
#===================
$ sudo adduser git
$ su git
$ cd
$ mkdir .ssh && chmod 700 .ssh
$ touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys
#on server’s computer
$ mkdir project.git
git 一部分
mkdir gitSparse
cd gitSparse/
git init
git remote add -f origin https://github.com/bestswifter/MySampleCode.git
ls
git config core.sparsecheckout true
echo “CornerRadius” >> .git/info/sparse-checkout
cat ./.git/info/sparse-checkout
git pull origin master
$ cd project.git
$ git init –bare
on client’s computer
====================
$ cd myproject
$ git init
$ git add .
$ git commit -m ‘initial commit’
$ git remote add origin git@gitserver:/opt/git/project.git
$ git push origin master
push code to a remote server (with public IP) from local:
You could push the changes to the web server, instead of trying to pull them:
Set up a repos on the web server:
cd /somedir
git init –bare
Push to that repos from your dev machine:
git remote add web user@web:/somedir
git push web master