Git global setup
git config --global user.name "xiaohuge"
git config --global user.email "[email protected]"
Create new repository
git clone [email protected]:kongrun/LeetCode.git
cd test
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
Existing folder or Git repository
cd existing_folder
git init
git remote add origin [email protected]:kongrun/LeetCode.git
git add .
git commit -m "leetcode"
git push -u origin master
如果希望保留生产服务器上所做的改动,仅仅并入新配置项, 处理方法如下:
git stash
git pull
git stash pop
然后可以使用Git diff -w +文件名 来确认代码自动合并的情况.
反过来,如果希望用代码库中的文件完全覆盖本地工作版本. 方法如下:
git reset –hard
git pull
1 git基本配置
gitconfig–globaluser.namezhangan git config –global user.email [email protected]
应用配置级别
–local(本地仓库) > –global(当前用户) > –system(整个系统)
2 查看配置
$ git config –list –global
git config –get-all user.name #local repo git config file)
git config –global –get-all user.name #user config file)
git config –system –get-all user.name #system git config file)
git commit已提交的Author信息可以通过git log查看
$git log