git bash操作指令

克隆项目指定分支:

# <branchname> 分支名,<remote-repo-url> 远程仓库url
git clone --branch <branchname> <remote-repo-url>
或
git clone -b <branchname> <remote-repo-url>

查看项目仓库的分支列表

# 进入项目目录中
git branch -a

本地代码已经变动,但需要拉去远程代码,又暂时不想提交代码:

# 1、先将本地代码放入暂存区
git stash

# 2、拉取到远程代码
git pull

# 3、将暂存区的代码合并进来,这样自己的代码就还是未提交状态
git stash pop

# 4、添加变动文件
git add .

# 5、编辑完个人代码后,再提交
git commit -m "指定提交的信息"

# 6、推送本地代码到远程默认分支
git push

posted @ 2024-08-13 16:42  二月雪  阅读(5)  评论(0编辑  收藏  举报