git建立分支

1、在你的项目里面右键选择Git Bash Here打开黑窗口

git clone x (x为git仓库链接)

2.在idea中新建分支并上传代码(在此处输入指令)

//1.新建分支
git branch xxx (xxx填写你的分支名称)

//2.查看所有分支
git branch -a

//3.切换到某一分支
git checkout xxx (xxx填写要切换的分支名称)

//4.添加修改代码到缓存(注意最后的"."前面有个空格)
git add .

//5.添加提交代码的备注
git commit -m "xxx" (xxx为本次提交代码的备注)

//6.提交代码到指定分支
git push origin xxx (xxx为要提交代码的分支名称)


//7.成功
C:\Users\Administrator\Desktop\demo>git branch one

C:\Users\Administrator\Desktop\demo>git branch -a
* master
  one
  remotes/origin/master

C:\Users\Administrator\Desktop\demo>git checkout one
Switched to branch 'one'

C:\Users\Administrator\Desktop\demo>git add .

C:\Users\Administrator\Desktop\demo>git commit -m "one"
On branch one
nothing to commit, working tree clean

C:\Users\Administrator\Desktop\demo>git push origin one
Enumerating objects: 23, done.
Counting objects: 100% (23/23), done.
Delta compression using up to 8 threads
Compressing objects: 100% (8/8), done.
Writing objects: 100% (12/12), 893 bytes | 893.00 KiB/s, done.
Total 12 (delta 5), reused 0 (delta 0)
remote: Powered by GITEE.COM [GNK-6.2]
remote: Create a pull request for 'one' on Gitee by visiting:
remote:     https://gitee.com/liu1-liu1/demo/pull/new/liu1-liu1:one...liu1-liu1:master
To https://gitee.com/liu1-liu1/demo.git
 * [new branch]      one -> one


版权声明:本文为qq_49102031原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。