git add . git commit "提交信息" git push 然后 git status 或 git pull 查看是否提交成功。
这3步,把所有本地修改的提交上去。 git status 查看当前的状态,有多少没有提交的,哪些文件有修改或新增,都可以看到。建议操作git 指令之前,先走一下这个 git status 指令。
git clone只能clone远程库的master分支,无法clone所有分支,解决办法如下:
git branch -a,列出所有分支名称如下:
remotes/origin/dev
remotes/origin/release
切换分支 git checkout -b dev origin/dev,作用是checkout远程的dev分支,在本地起名为ldev分支,并切换到本地的dev分支
git checkout -b release origin/release,作用参见上一步解释
git checkout dev,切换回dev分支,并开始开发。
error: You have not concluded your merge (MERGE_HEAD exists).
hint: Please, commit your changes before merging.
情况一: 如果你不要本地的修改内容 可以这样做如下
https://blog.csdn.net/daotiao0199/article/details/82757056 (参考)
git fetch 只是下载远程的库的内容,不做任何的合并, 然后 git reset 把HEAD指向刚刚下载的最新的版本
pascal:otalk-front-end bruce$ git fetch --all
Fetching origin
pascal:otalk-front-end bruce$ git reset --hard origin/master
HEAD is now at 305c4243 JW 提交特有静态文件
pascal:otalk-front-end bruce$ git pull
Already up-to-date.
pascal:otalk-front-end bruce$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
(use "git add ..." to include in what will be committed)
.DS_Store
nothing added to commit but untracked files present (use "git add" to track)
pascal:otalk-body bruce$ git show
commit 70a6b7581ed056cb5a612117389067595e4f2bb9
Merge: 656a34b c4248dd Author: JK 4xxxxxx9@qq.com
Date: Thu Mar 21 15:05:09 2019 +0800
git diff 70a6b7581ed056cb5a612117389067595e4f2bb9(commitid)
对比自己本地的更改与远程仓库的区别;
git diff 656a34b(mergeID)
进入查看提交的代码的增加(++)与删减(--) , 按键 ⬆️/⬇️ 查看
(shift+ 两下zz )退出
写着写着发现这个git教程挺好的 : http://www.softwhy.com/article-8491-1.html