8. git checkout:检出代码 常见用法 git checkout 5a5d53e(检出5a5d53e对应版本) git checkout filename 5a5d53e(检出5a5d53e对应版本的某文件) git checkout HEAD^(检出前一版本的代码) git checkout -b branch_name(检出并创建新分支) git checkout branc
git checkout master 意思是切换到本地master分支 git checkout daily/0.01 意思是切换到daily/0.01分支 4、拉取远程分支 当我想从远程仓库拉取一条本地不存在的分支 git checkout -b 本地分支名 origin/远程分支名 git checkout -b daily/0.01 origin/daily/0.01 意思是将远程的daily/0.01分支拉到本地,并且...
2.git checkout 切换分支 如果我们目前在master分支,情况如下图: 我们现在需要切换到newImage分支,所以可以 git checkout newImage git commit 我们就会发现newImage已经到下方了,而且*这个符号正在newImage上面,也就是说目前我们在的分支是newImage。 3.git checkout -b 一次性搞定创建与切换分支 如果你觉得以上创...
想要新建一个分支并同时切换到那个分支上,你可以运行一个带有 -b 参数的 git checkout 命令: $ git checkout -b iss53 Switched to a new branch "iss53" 它是下面两条命令的简写: $ git branch iss53 $ git checkout iss53 Figure 19. 创建一个新分支指针 你继续在 #53 问题上工作,并且做了...
<localBranch> 指本地已有分支 <originBranch> 指远程分支 <branchName> 指分支名称 <repoAddress> 指仓库地址 <commit> 指某个commit记录 origin 指远程仓库 本章节主要讲述 add、branch、stash和checkout命令 为了更好的阅读体验,请使用掘金访问 add命令 作用 用来确定将那些文件放在暂存区中,这些文件将包含在下...
$ git add.$ git commit-m'add test.txt'[master3e92c19]add test.txt1file changed,1insertion(+)create mode100644test.txt $ ls README test.txt $ git checkout testingSwitchedto branch'testing'$ ls README 当我们切换到testing分支的时候,我们添加的新文件 test.txt 被移除了。切换回master分支的时...
创建分支命令:git branch(branchname) 切换分支命令:git checkout(branchname) 当你切换分支的时候,Git 会用该分支的最后提交的快照替换你的工作目录的内容, 所以多个分支不需要多个目录。 === === master有5个txt文件。创建分支后,我在原来的E盘下面,提交第六个txt文件。 ===...
用于从远程仓库拉取最新的代码到本地仓库。可以指定分支名进行拉取。git branch 用于查看、创建或删除分支。git checkout 分支名 或 git switch 分支名 用于切换分支。git log 或 git log –oneline 用于查看提交历史记录。oneline 参数可以简洁地展示每个提交的概要信息。git diff 或 git diff &...
功能:从远程仓库拉取最新的代码到本地仓库。可以指定分支名进行拉取。git branch 功能:查看、创建或删除分支,用于管理不同的任务或功能分支。git checkout 分支名 或 git switch 分支名 功能:切换分支,用于快速切换到其他分支进行工作。git log 或 git log –oneline 功能:查看提交历史记录...
# 1.创建分支 git branch 分支名 # 绿色的意思是当前所在分支 # 2.查看分支 git branch # 3.切换分支 git checkout 分支名 # 4.创建并切换到分支 git checkout -b 分支名 # 5.删除分支 git branch -d 分支名 # 应该切换到其他分支,再删除 # 6.查看远程分支 git branch -a # 7.合并分支 git mer...