branch

Git 创建分支与合并分支

我的梦境 提交于 2019-12-21 20:05:24
下面以branchName=>aiMdTest为例介绍 1、 下载code   git clone masterUrl iva(另存文件名) 2、 创建并切换分支   cd iva   git checkout -b aiMdTest(创建并切换分支到aiMdTest)   git checkout命令加上-b参数表示创建并切换,相当于以下两条命令:   git branch aiMdTest   git checkout aiMdTest 3、 git branch命令查看当前分支   git branch命令会列出所有分支,当前分支前面会标一个*号。 4、 然后,我们就可以在aiMdTest分支上正常提交,   git add readme.txt   git commit -m "branch test" 5、 现在,aiMdTest分支的工作完成,我们就可以切换回master分支:   git checkout master 6、 现在,我们把aiMdTes分支的工作成果合并到master分支上:   git merge aiMdTest   log:Updating dc6576b..18159b5        Fast-forward        readme.txt | 1 +   1 file changed, 1 insertion(+) git

git学习4:分支管理

跟風遠走 提交于 2019-12-21 20:04:32
每次提交,Git都把它们串成一条时间线,这条时间线就是一个分支。截止到目前,只有一条时间线,这个分支叫主分支,即 master 分支, HEAD 指向 master , master 指向提交,所以, HEAD 指向的就是当前分支。每次提交, master 分支都会向前移动一步,这样,随着你不断提交, master 分支的线也越来越长。 当我们创建新的分支 dev 时,git新建了一个指针叫 dev ,指向 master 相同的提交,同时把 HEAD 指向 dev ,就表示当前分支在 dev 上,不过,从现在开始,对工作区的修改和提交就是针对 dev 分支了,比如新提交一次后, dev 指针往前移动一步,而 master 指针不变,假如我们在 dev 上的工作完成了,就可以把 dev 合并到 master 上。最简单的 合并 方法,就是直接把 master 指向 dev 的当前提交,就完成了合并。 合并完分支后,甚至可以删除 dev 分支。删除 dev 分支就是把 dev 指针给删掉,删掉后,我们就剩下了一条 master 分支 首先,创建dev分支并切换到该分支, git checkout -b dev 解释:-b表示创建并切换, 相当于两条命令: git branch dev git checkout dev 可以用命令git branch查看当前分支,会列出所有分支

Git掌握这些命令就够啦

夙愿已清 提交于 2019-12-21 20:03:19
//git init 初始化 //git status 获取状态 //git add //git commit-m "描述" //git branch 分支 //git branch a 添加分支 //git checkout a 切换分支 //mkdir: XX (创建一个空目录 XX指目录名) //pwd: 显示当前目录的路径。 //git init 把当前的目录变成可以管理的git仓库,生成隐藏.git文件。 //git add XX 把xx文件添加到暂存区去。 //git commit –m “XX” 提交文件 –m 后面的是注释。 //git status 查看仓库状态 //git diff XX 查看XX文件修改了那些内容 //git log 查看历史记录 //git reset HEAD file 可以把暂存区的修改撤销掉(unstage),重新放回工作区 //git reset –-hard HEAD^ 或者 git reset –hard HEAD~ 回退到上一个版本 // (如果想回退到100个版本,使用git reset –hard HEAD~100 ) //cat XX 查看XX文件内容 //git reflog 查看历史记录的版本号id //git checkout -- XX 把XX文件在工作区的修改全部撤销。 //git rm XX 删除XX文件 /

git命令

余生颓废 提交于 2019-12-21 20:00:09
通过命令 显示当前目录: pwd 通过命令 git init 把这个目录变成git可以管理的仓库 通过命令 git add readme.txt添加到暂存区里面去 通过命令 git commit告诉Git,把文件提交到仓库:git commit -m 'readme.txt' 通过命令 git status来查看是否还有文件未提交 通过命令 git diff readme.txt 查看到底修改了什么 通过命令 git log 查看历史纪录 通过命令 git reset --hard HEAD^ 退回上一个版本 ,上上个HEAD^^ 通过命令 cat readme.txt 查看详情 通过命令 git checkout --readme.txt 意思就是,把readme.txt文件在工作区做的修改全部撤销 做全局的配置 查看自己的用户名和邮箱地址: $ git config --global user.name "zhangsan"    $ git config user.name $ git config --global user.email "zhangsan@139.com" $ git config user.email 本地分支推送到github上:git push origin master 克隆一个本地库:git clone https://github.com/**

Git使用初步

眉间皱痕 提交于 2019-12-21 19:54:57
1.什么是版本控制 版本控制(Revision control),也叫版本管理,是一种软件工程技巧,藉以在开发的过程中,确保由不同人所编辑的同一档案都能得到更新,大大方便了多人协作完成同一个工程。版本控制通过文档控制(documentation control)记录工程中每一个模块的改动,并为每次改动编上序号,以此可以方便的查询或者是恢复到以前版本。 2.为什么需要版本控制? 没有版本管理工具的协助,在开发中我们经常会遇到下面的问题: a.无法跟踪文件改动。有人删除或者添加了一个文件时,你很难发现;这种情况也会发现在我们自己身上,有时候误删的事也会有。或者还会有不小心的覆盖等。 b.解决代码冲突困难。大家同时修改一个公共文件时,解决冲突也是个很头疼的问题。最原始方法是手动打开冲突文件,逐行比较,再手工粘帖复制。 c.参考a,b。 此外,还有一个很有诱惑里的用法,你可以一会儿在笔记本上改,一会儿在台式机上改,不用担心,操作的都是同一个文件。有点像云服务,不过不同计算机间同步在分布式的版本控制系统上实现更方便。 3.版本控制系统的发展历史 a.最原始的方法是为不同的版本新建一个文件夹。ok,亲身经历过不小心把整个文件夹shift+delete的悲剧。后来有种流行的东西叫rcs,通过记录文件的改动来达到版本控制的目的,俺没用过。 b.集中式版本控制系统。如著名的CVS,SVN等,抱歉

Git工作中常用命令

℡╲_俬逩灬. 提交于 2019-12-21 15:11:00
以下是目前工作中常用到的Git的使用流程: git checkout master git pull git checkout -b <branch name> ##经过一系列开发 ##从工作区提交全部文件到暂存区 git add . ##从暂存区恢复到工作区 git reset HEAD <file> ##提交到版本库 git commit -m "提交注释" ##第一次push本地分支到远程 git push --set-upstream origin <branch name> ##多次提交,完成工作后 ##删除本地分支: git branch -d <branch name> ##删除本地的远程分支: git branch -r -d <branch name> ##删除远程分支: git push origin -d <branch name> 来源: CSDN 作者: 梁天意 链接: https://blog.csdn.net/Tianyi_liang/article/details/103642311

Branching in Mercurial

安稳与你 提交于 2019-12-21 10:18:45
问题 I have starting using Mercurial for my (our) versioning needs. I have now come to the point that I need to create a feature branch. However, now that I have started working on it -- and I try to push my changes, I keep getting a warning about new remote heads. That's stupid, I know that there will be new remote head(s) that's what a branch after all is? How am I supposed to create branches and push them without this problem, without using force push as it is surely not the right way to go,

Branching in Mercurial

心不动则不痛 提交于 2019-12-21 10:16:29
问题 I have starting using Mercurial for my (our) versioning needs. I have now come to the point that I need to create a feature branch. However, now that I have started working on it -- and I try to push my changes, I keep getting a warning about new remote heads. That's stupid, I know that there will be new remote head(s) that's what a branch after all is? How am I supposed to create branches and push them without this problem, without using force push as it is surely not the right way to go,

How to choose the right branch/fork to use by looking on the github's network graph?

允我心安 提交于 2019-12-21 09:36:08
问题 I need to use 3rd-party code that's available publicly on github. I'm looking at the github's network graph of that code and I can see that other forks have some commits that aren't merged into the original repository. How should decide which of the branches/forks is right for me? Please enlist your considerations while facing a problem like this. As suggested by John Feminella, one should always use the (usually stable) 'released versions of a project'. I agree with that of course, but this

Mercurial, “Branching with bookmarks”

时间秒杀一切 提交于 2019-12-21 09:35:15
问题 I read this document: A Guide to Branching with Mercurial, specifically the section titled Branching with Bookmarks. It says: Now you’ve got two bookmarks (essentially a tag) for your two branches at the current changeset. To switch to one of these branches you can use hg update feature to update to the tip changeset of that branch and mark yourself as working on that branch. When you commit, it will move the bookmark to the newly created changeset. I tried this, but it ended up moving both