Skip to main content

git

#Windows环境中使用/作为路径分隔符,--global表示全局配置,不加则只对当前Git项目生效。

git config core.sshCommand "ssh -i /path/to/your/privateKey"

git config -e

git remote set-url origin git@github.com:test/thinkphp.git

git reset --hard HEAD^ 来回退到上一次commit的状态。

git reset --hard commitid   此命令可以用来回退到任意版本

git reset HEAD .   放弃所有的缓存(add 后)的,可以使用 命令。

git checkout .    放弃所有的未缓存(未 add 后)的

commit规范 开发过程中尽量减少commit的次数,添加有意义的comment comment格式示例:feature:增加xxx新功能 modify:修改xxx功能 bugfix:修复xxxxxbug

git config user.name 查看用户名 git config user.name 'arick' 设置用户名 git config user.email 查看邮箱 git config user.password

添加远程版本库:

git remote add [shortname] [url]

#提交到 Github $ git remote add origin git@github.com:tianqixin/runoob-git-test.git $ git push -u origin master

git remote -v

git remote rm name # 删除远程仓库 git remote rm orgin git remote rename old_name new_name # 修改仓库名