泉州个人建站模板,免费咨询刑事辩护在线律师,上海手机网站哪家最好,去掉/wordpressGIT学习指导的游戏#xff1a;http://pcottle.github.io/learnGitBranching/?NODEMO git fetch: 下载远端所有分支的本地没有的提交列表#xff0c;并更新local分支origin/master 1. 从remote下载local resp未包含的提交对象#xff1b; 2. 更新local resp的远端分支点(如… GIT学习指导的游戏http://pcottle.github.io/learnGitBranching/?NODEMO git fetch: 下载远端所有分支的本地没有的提交列表并更新local分支origin/master 1. 从remote下载local resp未包含的提交对象 2. 更新local resp的远端分支点(如: origin/master) git fetch origin remoteBranch:localBranch // 下载远端的分支到本地分支 git fetch orign :localNewBranch // 不指定Source时创建本地新分支 合并local resp的两个分支有以下方式 1. git cherry-pick o/master 2. git rebase o/master 3. git merge o/master git pull: 就是git fetch与git merge origin/master的组合 1. 下载并更新local origin/master 2. 将local分支origin/master合并到local的当前分支中 注如果要替换pull默认的merge操作可以使用git pull --rebase当然rebase是从当前分支到origin/master分支中因为remote提交的可能会很多如果本地很多remote少可以反过来 git push: 提交local的当前分支 到remote的该分支中并更新local的origin/master分支 1. 提交local的当前分支 到remote的该分支中 2. 更新local的origin/master分支 A先checkout remote的mater分支到local的master分支开发new featureB此后多次提交到remote的master分支A要提交之前必先下载合并代码确保代码工作无误后才提交 1. git fetch 更新local的origin/master分支 2. git rebase origin/master 以origin/maste为主分支衍合当前分支master此时master比origin/master多前进了feature提交测试功能或者再提交 3. git push 提交到remote并更新local的origin/master分支 注如果将步骤2的rebase替换为merge那么在步骤3的push中remote也会做merge操作 关于让某个分支HEAD快速前进 master分支的head在C1feature1分支的head在C2C1 -- C2想要将master的head移到C2上可以git rebase feature1 master以feature1分支为主干衍合其它分支 git rebase feature1 都是以feature1分支为主分支衍合当前分支master git rebase feature1 master 都是以feature1分支为主分支衍合master分支 1. 按提交顺序如果master在feature1的上面则将master的HEAD前移即快速前进 2. 按提交顺序如果master与feature1并列则复制master的更新HEAD指向最新提交 3. 按提交顺序如果master在feature1的下面则提示分支已经是最新的 跟踪远端分支 git checkout -b newBranchName o/master git branch -u o/master existedBranchName // 重新设置upstream. (-u) 将本地master分支的提交列表推送到origin仓库的master分支中 git push origin master 将本地分支或者HEAD指向的提交推送到origin仓库的已存在分支或者新分支中 git push origin localBranch^:remoteNewBranch 不指定source时删除分支localBranch git push origin :localBranch remoteBranch下载到localBranch中再在当前正在工作的branch中merge localBranch。 git pull origin remoteBranch:localBranch Pro Git学习笔记 本地工作目录的三种状态 已提交 commited -- 已修改 modified -- 已暂存 staged命令git config // 添加别名git config --global alias.short full-name git clone // 从远程仓库下载到本地目录 git status // 工作目录中各文件的状态“已修改”、“已暂存” 状态变更git add file // 放到暂存区处于“已暂存” git commit -m commitMessage // 提交文件状态为已提交 git commit -a -m // 跳过暂存直接提交 git rm file // 从暂存区移除文件git rm file -f // 永久移除该文件待提交git rm file --cache // 保存该文件不提交git reset head file // 取消已暂存恢复到工作目录git commit --amend -m msg // 修改最后一次提交将暂存区覆盖上次的提交弥补上次的部分缺失git checkout file // 取消已修改恢复到上次最新的代码 远程仓库git remote -v // 查看远程仓库git remote add name url // 添加远程仓库 git remote show remote-repository-name // 查看某个远程仓库的详细信息 git remote rename old-name new-name // 更改远程仓库的名字 git fetch remote-name // 从远程仓库抓取数据到本地// 本地推送到远程仓库的某个分支上git push remote-repository-name remote-branch-name// 将所有本地标签上传过去git push --tags 分支管理 git branch -a // 查看本地所有分支 git branch branch-name // 创建分支 git branch -d branch // 删除分支-D 强制删除 git checkout branch // 切换分支切换工作目录到某一个分支 git checkout -b branch // 创建分支并切换到该分支 git checkout -b branch remote-resp/remote-branch git merge branch // 将branch合并到当前分支中 git push remote-resp branch // 将分支推送到远程仓库的该分支下 git push remote-resp branch:remote-branch // 将分支推送到远程仓库的某branch下 git push remote-resp :remote-branch // 删除远程仓库下的branch git rebase branch // 将当前分支衍合到branch中 转载于:https://www.cnblogs.com/diydyq/p/4103007.html