工作流
个人工作流
团体工作流
1. pull
2. add
3. pull
4. commit
5. push
本地仓库->工作区
修改
工作区 -> 本地仓库
git restore file
git checkout -- file
区别
git diff file
工作区 -> 暂存区
git add file
git rm file
暂存区 -> 工作区
git restore --staged
区别
git diff --cached
暂存区 -> 本地仓库
git commit -m "b"
本地仓库 -> 暂存区
git reset --soft HEAD^1
本地仓库(high commit id) -> 本地仓库(low commit id)
git reset --hard HEAD^1
git reset --hard commit_id
- local repository 与 remote repository 之间
local repository -> remote repository
git push origin master
remote repository -> local repository
git pull
git fetch
库间的关联
git remote remove origin
git remote add origin url
pull 时的冲突
pull 时的冲突
1. 工作区的冲突(与远程仓库)
Please move or remove them before you merge.
2. 暂存区的冲突(与远程仓库)
Please commit your changes or stash them before you merge.
3.1. 本地仓库的冲突(与远程仓库)
3.1 CONFLICT (add/add): Merge conflict in file_xxx
Auto-merging file_xxx
Merge made by the 'recursive' strategy.
弹出一个vim窗口,让你输入 merge 信息.(该窗口中的非#开头的都是merge信息)
这次vim窗口关闭后,会创建一个提交,这次提交是一次merge
3.2 CONFLICT (add/add): Merge conflict in file_xxx
Auto-merging file_xxx
Automatic merge failed; fix conflicts and then commit the result.
On branch master
Your branch and 'origin/master' have diverged,
and have 1 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
You have unmerged paths.
(fix conflicts and run "git commit")
(use "git merge --abort" to abort the merge)
Unmerged paths:
(use "git add <file>..." to mark resolution)
both added: file_xxx
cat file_xxx
<<<<<<< HEAD
aaa
=======
bbb
>>>>>>> f48bced1363868fa834c814e393e492c06fe01b6
修改掉 <<和 >> ,然后 git add 和 git commit
|