Git Bash 常用操作

初始化Git仓库:

git init

初始化其他目录作为Git仓库:

git init otherFile

添加文件命令:

git add filename

批量添加文件命令:

git commit -a

提交到仓库:

git commit -m "提交日志"

推送到服务器:

git push https://xxx.xxx.xxx.xxx.git
//如果已经配置过仓库路径,可直接push
git push

从服务器拉取代码:

git clone https://xxx.xxx.xxx.xxx.git

从服务器拉取指定分支:

git clone -b xxxx URL

从服务器更新:

git pull

删除资源库中的文件:

git rm file

新建分支:

git branch test

切换到分支:

git checkout test
//一般主分支默认为master
git checkout master

合并分支:

git merge test

删除分支:

git branch -d test

一般是使用开发工具在GUI下操作的,目前能记得的就这些,如果想起再补充。

猜你喜欢

转载自blog.csdn.net/c__chao/article/details/79800013