|
|
描述 | 截图 |
|
将项目克隆到本地 |
--xxx是git的地址git clone xxxx |
![]() |
| 或者初始化git |
--新建一个readme.md文件echo "# git_command_Demo" >> README.md--初始化git git init--将文件加入git git add README.md--提交 git commit -m "first commit"--本地git连上远程的git git remote add origin https://github.com/xxx.git--推送 git push -u origin master |
![]() |
| 查看分支 |
--查看本地分支git branch--查看远程分支(-r即 -remotes)git branch -r --查看所有分支git branch -a |
![]() |
| 新建分支 |
--在本地新建一个分支,并切换到该分支上去git checkout -b newBranch1--将本地分支推送到远程服务器git push origin newBranch1 |
|
| 切换分支 |
--xxxx表示 是你的分支名称 git checkout xxxx |
|
| 删除分支 |
先切到master分支,再删除当前本地分支
在master分支,删除-远程分支
在master分支,查看git版本
|
|
| 合并分支 |
在master分支,将别的分支加入主分支 有时候会merge失败,做撤销操作 |
|
| 创建gitignore文件 |
git 新增.gitignore文件,github上已经有对应的vs开发产生不必要的提交文件:https://github.com/github/gitignore/blob/master/VisualStudio.gitignore touch .gitignore |
![]() |
| 提交文件 |
新建了控制台项目,提交文件 |
![]() |
| 撤销 |
撤销提交: 可以查看提交的日志以及uid git log --xxxx表示你提交的uid git reset --hard xxxx |
|
| cherry-pick |
在分支A做了改动,分支B同样也要改动: --xxxx表示你提交的uid git cherry-pick xxxx |
|
|
|
||
|
|
||




