推到此分支:
git add .
git commit -m"xxx"
git push
切换分支:git checkout xxx(分支名) 添加新分支但是留在当前分支
git branch <new name>
添加并切换到新分支:
git checkout -b <new name>
忽视哪些文件不push上去: 创建.gitignore文件 拉取分支: git pull 拉取主分支:
git pull origin master
查看历史提交记录
git log
结果:
PS C:\Users\heziyi6\Desktop\automind-backend> git log commit 1a7bcbc5397488d488829e7ff190233d724efb29 (HEAD -> feature-2, origin/feature-2) Author: heziyi 1417243391@qq.com Date: Sat Mar 12 11:28:32 2022 +0800
commit 7ac690cafb5dfb6885b6030014cedb28aa1da3f1 Merge: 985a547 4dc81e2 Author: heziyi 1417243391@qq.com Date: Sat Mar 12 11:16:35 2022 +0800
回退到某个分支:
git reset --hard 1a7bcbc5397488d488829e7ff190233d724efb29
列出本地已经存在的分支:
git branch
列出远程分支
git branch -r
列出本地分支和远程分支
git branch -a
例子:
PS C:\Users\heziyi6\Desktop\automind-backend> git branch -a
- feature-1 master remotes/origin/HEAD -> origin/master remotes/origin/develop remotes/origin/feature-1
remotes/origin/feature-2 remotes/origin/feature-export_word remotes/origin/master …skipping… - feature-1 master remotes/origin/HEAD -> origin/master remotes/origin/develop remotes/origin/feature-1
remotes/origin/feature-2 remotes/origin/feature-export_word remotes/origin/master
查看现有远程仓库的地址url
git remote -v
|