git

git上传远程git库

关联并拉取远程仓库

  • 初始化当前目录为本地仓库

git init

  • 添加远程仓库,并指定项目名

git remote add <project_name> http:....(远程仓库)

  • 查看远程仓库

git remote -v

  • 设置git记住用户名密码,将来输入用户密码后会自动保存

git config --global credential.helper store

  • 从远程拉取仓库,可不带分支,之后再检出分支,若带分支,则相当于多执行了一步检出分支(git checkout <branch_name>)

git pull <project_name> <branch_name>

  • 检出分支,若不指定分支,则检出master

git checkout <branch_name>

  • 查看分支

git branch

提交到本地仓库并推送到远程仓库

  • 添加新文件到index区(暂存区)以待提交

git add <file_name>

  • 添加修改文件到到index区(暂存区)以待提交

git stage <file_name>

  • 提交

git commit -m "add some comments"

  • 推送远程

git push <project_name> <branch_name>

ssh 方式连接git

https://www.jianshu.com/p/79a4b15f6e3e

https://blog.csdn.net/m0_37477061/article/details/82950079

posted @ 2019-11-28 23:10  keep-minding  阅读(160)  评论(0编辑  收藏  举报