git常用命令

下载私有项目 git clone https://username:password@github.com/xxx/xxx.git /var/www/xxx

创建分支 git branch test

将分支提交到远程 git push origin test:test

查看远程分支 git branch -r

查看各分支的最后一次提交 git branch -v

切换分支 git chekout 分支名

提交代码到分支 git push origin test

整个文件夹提交 git add /var/www/git/

长期保存密码: git config --global credential.helper store  //执行这个命令后,第一次提交需要输入用户名密码,以后就不需要了

设置记住密码:git config --global credential.helper cache //默认15分钟

设置记住密码时间:git config --global credential.helper 'cache --timeout=3600' //设置一个小时内有效

删除文件:git rm -f 文件; git commit; git push;

原文地址:https://www.cnblogs.com/xiaozong/p/5566085.html