git常用代码

1.重新设置远程仓库

git remote set-url origin  https://gitee.com/Demo.git

2.分支操作

   1.查看所有分支

git branch -a

   2.查看当前使用分支

git branch

   3.切换分支

git checkout 分支名

操作事例:

我clone了devlop分支的代码,修改后想上传到master分支

1.检查分支git branch 看当前分支

 *在develop分支上,所以我们切换分支

2.切换分支

git checkout master

切换完分支就可以走提交流程了

3.提交

1.添加文件到仓库

git add 文件

或者添加所有文件

git add -A

2.提交日志

git commit -m "first commit"

 3.拉取 + 推送

git pull 
git push

Guess you like

Origin blog.csdn.net/yonggandess/article/details/120670144