branch

Switch on another branch (create if not exists), without checking if already exists?

六眼飞鱼酱① 提交于 2019-11-27 02:01:54
问题 git checkout -b foo switches on foo branch (even if it doesn't exist, it is created), but if the foo branch already exists it throws an error like this: fatal: A branch named 'foo' already exists. What's the command that does the following check? if the branch already exists, just switch on it ( git checkout foo ) if the branch doesn't exist, create it and switch on it ( git checkout -b foo ) 回答1: Update Q3 2019 (Git 2.23): there now actually is a git switch command! git switch -c aBranch You

SVN 目录结构

自闭症网瘾萝莉.ら 提交于 2019-11-27 01:51:16
Subversion有一个很标准的目录结构,是这样的。 比如项目是proj,svn地址为svn://proj/,那么标准的svn布局是 svn://proj/|+-trunk+-branches+-tags 这是一个标准的布局,trunk为主开发目录,branches为分支开发目录,tags为tag存档目录(不允许修改)。但是具体这几个目录应该如何使用,svn并没有明确的规范,更多的还是用户自己的习惯。 对于这几个开发目录,一般的使用方法有两种。我更多的是从软件产品的角度出发(比如freebsd),因为互联网的开发模式是完全不一样的。 1.第一种方法,使用trunk作为主要的开发目录 一般的,我们的所有的开发都是基于trunk进行开发,当一个版本/release开发告一段落(开发、测试、文档、制作安装程序、打包等)结束后,代码处于冻结状态(人为规定,可以通过hook来进行管理)。此时应该基于当前冻结的代码库,打tag。当下一个版本/阶段的开发任务开始,继续在trunk进行开发。 此时,如果发现了上一个已发行版本(Released Version)有一些bug,或者一些很急迫的功能要求,而正在开发的版本(Developing Version)无法满足时间要求,这时候就需要在上一个版本上进行修改了。应该基于发行版对应的tag,做相应的分支(branch)进行开发。 例如,刚刚发布1.0

关于SVN 目录结构

我们两清 提交于 2019-11-27 01:50:33
Subversion有一个很标准的目录结构,是这样的。比如项目是proj,svn地址为svn://proj/,那么标准的svn布局是 svn://proj/ | +-trunk +-branches +-tags 这 是一个标准的布局,trunk为主开发目录,branches为分支开发目录,tags为tag存档目录(不允许修改)。但是具体这几个目录应该如何使 用,svn并没有明确的规范,更多的还是用户自己的习惯。 对于这几个开发目录,一般的使用方法有两种。我更多的是从软件产品的角度出发 (比如freebsd),因为互联网的开发模式是完全不一样的。 第一种方法,使用trunk作为主要的开发目录。 一般的,我们的所有的开 发都是基于trunk进行开发,当一个版本/release开发告一段落(开发、测试、文档、制作安装程序、打包等)结束后,代码 处于冻结状态(人为规定,可以通过hook来进行管理)。此时应该基于当前冻结的代码库,打tag。当下一个版本/阶段的开发任务开始,继续在trunk 进行开发。此时,如果发现了上一个已发行版本(Released Version)有一些bug,或者一些很急迫的功能要求,而正在开发的版本(Developing Version)无法满足时间要求,这时候就需要在上一个版本上进行修改了。应该基于发行版对应的tag,做相应的分支(branch)进行开发。例 如

Vendor Branching, Mercurial Style?

一笑奈何 提交于 2019-11-27 01:42:10
问题 The scene: A purchased web application, with regular updates from the vendor. We then, heavily customize the look and sometimes add our own functionality or fix a bug before the vendor gets to it. For version control, we have been using Subversion following their “Vendor Branch” model each time we received a new release. This has the added benefit that we have a, version controlled, vanilla copy of their system. The problem: We would like to switch to Mercurial and will likely follow the

Git branches with completely different content

浪尽此生 提交于 2019-11-27 00:53:20
问题 Since Git has the ability to keep track (and keep it clean) of branches with completely different content from each other, in the same repository, some projects (like Git itself) have started to make use of it. Git, for instance, uses one branch for the code itself, while keeping its documentation in a separate branch. Same repo, just different branches. It might just be me, coming from a SVN background, but I find it confusing to have 'nothing in common' in those branches. Development

git 使用

自古美人都是妖i 提交于 2019-11-27 00:50:00
相信小伙伴们对git不陌生吧,但是究竟git是怎么样工作的,它的构成又是怎么样的呢?我们来看看: 上图很明显的说明,git是又4个部分组成的: 工作区域--add-->暂存区域--commit-->本地版本仓库--push-->远程版本仓库 基本指令 1. add git add -u:将文件的修改、文件的删除,添加到暂存区。 git add .:将文件的修改,文件的新建,添加到暂存区。 git add -A:将文件的修改,文件的删除,文件的新建,添加到暂存区。 虽然网上是如上这么说,但是我试过好像git add . 和git add -A 效果是一样的。 2.commit commit -m:把暂存区的内容提交到本地版本区 commit -a -m:相当于git add -u和git commit -m组合 3.log 可以查看每个commit的版本号: 4.reflog 和log很像,比log能看得更多,git reset也可以看到 5.reset reset: "git reset --hard 版本号 " 执行这句就可以回滚代码回到对应的版本了,我们常用回滚 本地分支 的代码 其中版本号是上面红框的随机字符串,和git log的commit右边的字符串,一般取开头的几位就ok了 例如git reset --hard ad208 6.revert revert:也是回滚版本

How to REALLY delete a git branch (i.e. remove all of its objects/commits)?

随声附和 提交于 2019-11-27 00:44:52
问题 I have a git tree like A---B---C topic / D---E---F---G master <-- I would like to remove topic and all objects on it. I note the SHA ID of topic, then type: git branch -D topic git gc # <-- I also tried prune here... git checkout -b temp <SHA1 ID of topic> After the last command I expect to get an error (something like "Non-existent object ID..." or somth. like that). However there is no error and gitk shows the same tree structure as above?? What am I missing - I thought gc/prune are

Efficiency of branching in shaders

谁说胖子不能爱 提交于 2019-11-27 00:27:16
问题 I understand that this question may seem somewhat ungrounded, but if someone knows anything theoretical / has practical experience on this topic, it would be great if you share it. I am attempting to optimize one of my old shaders, which uses a lot of texture lookups. I've got diffuse, normal, specular maps for each of three possible mapping planes and for some faces which are near to the user I also have to apply mapping techniques, which also bring a lot of texture lookups (like parallax

Showing Git branch structure

微笑、不失礼 提交于 2019-11-27 00:22:28
问题 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. 回答1: I am not sure about what you mean by "branch structure". git log

How to find the current git branch in detached HEAD state

柔情痞子 提交于 2019-11-27 00:20:47
问题 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