branch

Git: How to find out on which branch a tag is?

不想你离开。 提交于 2019-11-28 05:12:56
I'm currently busy with a project with a lot of branches and I have a tag for last changes which where done on one of the branches. But it's not clear for me on which branch this tag is. How to find out on which branch a tag is? VonC Even shorter: git branch --contains tags/<tag> (it works for any tree-ish reference) If you can find which commit a tag refers to : git rev-parse --verify tags/<tag>^{commit} # or, shorter: git rev-parse tags/<tag>~0 Then you can find which branch contain that commit . git branch --contains <commit> As commented below by user3356885 , for the fetched branches

SVN分支/主干Merge操作小记

牧云@^-^@ 提交于 2019-11-28 04:56:21
一、前言   说来惭愧,鄙人从事开发多年,使用svn已经好几个年头了,但是却仅限于update、commit、compare之类的操作,最近想到github上学习别人写的NIO源码,顺便去熟悉git的使用,但是一想到svn,我心里虚了:用了那么多年却对其一知半解,就连最基本的权限分配都没有做过,更别说进行分支拉取和合并了,何谈去get其他技能?做技术的还是要踏实一点,近一年来,我都在对之前未深入的领域进行扫盲,所以,注定svn是绕不过的坎,于是乎开始各种查资料,安装svn服务端(Virtual SVN)和客户端(TortoiseSVN),比对网上的博文进行各种尝试,不能说过程痛苦,但是当你在云里雾里摸索的时候挺难受的吧(顺便说下,在学习的时候精力一定要集中!对我而言,顺便塞上耳塞听音乐工作效率是事半功倍,哈哈哈~)~不废话了,今天这篇博文就讲讲SVN里面比较高级的操作:创建分支(branch)、将主干(trunk)中的代码合并到分支(branch)、将分支(branch)中的代码合并到主干(trunk)中~ 二、正文   说到分支和主干,我想不少coder也是比较少接触吧,毕竟很多时候,我们想着的还是如何赶进度~之所以出现分支和主干,就是希望主干和分支两份代码可以各自进行独立的管理互不影响,在需要的时候再进行合并。试想这样一种场景:公司项目已经完成一个阶段的开发计划

Show commits involved in a prior git merge

时光毁灭记忆、已成空白 提交于 2019-11-28 04:38:29
Say I create a hotfix branch off of a develop branch, make two commits, merge this back to the develop branch, and destroy the hotfix branch. How do I find out what commits were part of the merge? Is that possible? Colin Hebert If you want to see every commits merged in the last merge you can try that : git log $(git merge-base --octopus $(git log -1 --merges --pretty=format:%P)).. --boundary Here is an example of my current log : $ git log --graph --pretty=oneline --abbrev-commit * 44899b9 pouf * 8f49f9c Merge branch 'test' |\ | * 3db39ca test * | 69f431c pif * | df1f51c lala |/ * 8fae178

Is branch divergence really so bad?

自作多情 提交于 2019-11-28 04:31:21
I've seen many questions scattered across the Internet about branch divergence, and how to avoid it. However, even after reading dozens of articles on how CUDA works, I can't seem to see how avoiding branch divergence helps in most cases . Before anyone jumps on on me with claws outstretched, allow me to describe what I consider to be "most cases". It seems to me that most instances of branch divergence involve a number of truly distinct blocks of code. For example, we have the following scenario: if (A): foo(A) else: bar(B) If we have two threads that encounter this divergence, thread 1 will

How to find the current git branch in detached HEAD state

让人想犯罪 __ 提交于 2019-11-28 04:20:06
I can find the current git branch name by doing either of these: git branch | awk '/^\*/ { print $2 }' git describe --contains --all HEAD But when in a detached HEAD state, such as in the post build phase in a Jenkins maven build (or in a Travis git fetch), these commands doesn't work. My current working solution is this: git show-ref | grep $(git log --pretty=%h -1) | sed 's|.*/\(.*\)|\1|' | sort -u | grep -v HEAD It displays any branch name that has the last commit on its HEAD tip. This works fine, but I feel that someone with stronger git-fu might have a prettier solution? A more porcelain

Showing Git branch structure

女生的网名这么多〃 提交于 2019-11-28 04:07:59
Is there a way to show only the branch structure in Git? There are a number of tools that show the commits graphically, but in my case the list is so long that it's impossible to see the structure. I guess git-log could be the answer, but I can't find any switches that only show the branching commits. This along with "--graph --branches --oneline --all" could do the trick. EDIT: I'm looking for a way to do this in Ubuntu. VonC I am not sure about what you mean by "branch structure". git log can help visualize the branches made through commits (See this blog post ): [alias] lg = log --graph -

How to get commit where merged branch forked from

为君一笑 提交于 2019-11-28 03:48:50
问题 o---1---o---o---o---o master \ / o---o---2 feature Is it possible to get commit 1 without using reflog ? Using git 2.4.2 I tried: git merge-base master feature git merge-base feature master returns: commit 2 git merge-base --fork-point master feature git merge-base --fork-point feature master returns nothing ( exit code 1 ) Not duplicates: How to get a branch into a forked repo from the original repo in github git how to find commit hash where branch originated from How to get information

Need to restore a deleted branch in Subversion

人走茶凉 提交于 2019-11-28 03:38:35
I have two working copies of a Subversion repository, one of the trunk, and one of a branch I created. I accidentally deleted the branch in a repository browser. How do I restore the branch? Is there a way to undo the most recent commit for the whole repository? John Weldon Use: svn cp [path to deleted branch]@[revision before delete] [new path] For example: svn cp svn://myrepo.com/svn/branches/2.0.5@1993 \ svn://myrepo.com/svn/branches/2.0.5_restored Where 1993 is the revision before the delete... Here is some good documentation... There must be some way of escaping the @ symbol in the

git用法

五迷三道 提交于 2019-11-28 03:24:02
git用法 Git 是什么 Git是一个版本管理控制系统(缩写VCS),它可以在任何时间点,将文档的状态作为更新记录保存起来,也可以在任何时间点,将更新记录恢复回来。 团队开发会这些命令就够了!第一次使用git的时候设置用户名:git config --global user.name 【git用户名】​设置邮箱:git config --global user.email 【邮箱地址】​查看当前用户信息:git config --list ​操作步骤:初始化git仓库:git init​追踪文件:git add 【文件名】​将工作目录中的文件全部添加到暂存区:git add .​查看文件状态:git status​向本地仓库中提交代码:git commit -m 【提交时的描述】​用暂存区中的文件覆盖工作目录中的文件:git checkout 【文件名】​将文件从暂存区中删除:git rm --cached 【文件名】将 git 仓库中指定的更新记录恢复出来,并且覆盖暂存区和工作目录:git rest --hard commitID​查看提交记录:git log​克隆远程仓库文件到本地仓库:git clone 【 仓库地址】​把本地仓库的文件提交到远程仓库:git push 【仓库地址】【分支名称】 git push -u【仓库地址】【分支名称】-u 记住推送地址及分支

How do I make git-svn use a particular svn branch as the remote repository?

Deadly 提交于 2019-11-28 02:59:01
A word of warning: I'm a n00b to git in general. My team uses feature branches in svn , and I'd like to use git-svn to track my work on a particular feature branch. I've been (roughly) following Andy Delcambre's post to set up my local git repo, but those instructions seem to have led git to pick the svn branch that had changed most recently as the remote repository; the problem is that's not the branch I care about. How do I control which branch git-svn uses? Or am I approaching this completely wrong? UPDATE: I did use the -T , -b , and -t options (in my case because the svn repo has multiple