branch

git分支创建,查看,删除

佐手、 提交于 2019-11-30 14:35:26
#查看本地所有分支 git branch Git鼓励大量使用分支: 查看本地分支: git branch 查看本地和远程分支: git branch -a 创建本地分支: git branch <name> 例如: git branch dev 创建+切换本地分支: git checkout -b <name> 例如: git checkout -b dev 创建远程分支: 即把本地创建的分支推送到远程 git push origin <name>:<name> 例如: git push origin dev:dev 切换本地当前所在分支: git checkout <name> 例如: git checkout dev 删除本地分支:git branch -d <name> 例如: git branch -d dev 删除远程分支: git push origin --delete dev 合并某分支到当前分支:git merge <name> 分支代码版本过旧,需要将当前最新主干代码合并到当前分支 来源: https://www.cnblogs.com/smileblogs/p/11597807.html

Ambiguous Names with GIT?

一笑奈何 提交于 2019-11-30 14:25:10
I'm trying to check out one of my local branches, named TEAM20-lab2-release. When I try to do this, I get an ambiguous refname error: $ git branch TEAM20-lab2-release warning: refname 'TEAM20-lab1-release' is ambiguous. fatal: Ambiguous object name: 'TEAM20-lab1-release'. Here is the list of my branches: $ git branch -a TEAM20-lab1 * TEAM20-lab1-release master remotes/origin/HEAD -> origin/master remotes/origin/master VonC It usually is because you have the same name (than your branch) used in another namespace : like the " remotes " namespace: the name of a remote repo as illustrated by this

How do I list and fetch remote branches after SVN to Git migration? [duplicate]

会有一股神秘感。 提交于 2019-11-30 14:23:26
问题 This question already has answers here : How do I migrate an SVN repository with history to a new Git repository? (32 answers) Closed 6 years ago . I migrated our SVN repository to Git and pushed it to a central repository. We had a fair amount of tags and branches, but somehow we were not able to list and fetch those from a Git client. This was weird, because the tags and branches seemed to be available on the server. With help from a Jon Maddox blog post, a blog post from Marc Liyanage and

How to Shrink/Cut a Git Repo

半城伤御伤魂 提交于 2019-11-30 14:15:36
We have a Git repo with 7 contributing developers with over 2.5 years of history and about 10,000 commits. We use Assembla to push and pull from. When we add new developers cloning the repo to their dev computers takes almost an hour. I'm not sure if this is the proper terminology, but our goal is to "shrink" the repo by "cutting/snipping" off the first 1.5 years worth of commits and keeping only the latest year of history. We want to keep a "backup" copy of the entire repo, whether as a separate repo or maybe a branch? We'd like to repeat this in the future an possible merge the initial split

Branch name in build number

丶灬走出姿态 提交于 2019-11-30 14:13:30
I'm trying to put branch name into build number, but I can't find the right parameter. I'm using build number format : %teamcity.build.branch%.{0} It works, but when it trying to build default branch 'dev', teamcity names it as <default> . How to fix it ? I was able to solve this problem by: In my VCS Root - using git - set my Default Branch to: master In my VCS Root - using git - set my Branch Specification to: +:refs/heads/(master) +:refs/heads/(release-*) +:refs/heads/(hotfix-*) Create a Configuration Paramater: BuildNumberPrefix = SomeService.%teamcity.build.branch%.release_ Set my Build

git rebase master then push origin branch results in non-fast-forward error

匆匆过客 提交于 2019-11-30 14:04:15
I am trying on working on my featureA branch while keeping it up-to-date with the master branch. Here is the scenario git clone ssh://xxx/repo git checkout -b featureA $ git add file.txt $ git commit -m 'adding file' $ git push origin featureA meanwhile a couple new commits where pushed to origin master git checkout master git pull origin master git checkout featureA git rebase master git push origin feature A To ssh://xxx/repo ! [rejected] featureA -> featureA (non-fast-forward) error: failed to push some refs to 'ssh://xxx/repo' To prevent you from losing history, non-fast-forward updates

“if” versus “switch” [duplicate]

天涯浪子 提交于 2019-11-30 13:47:23
问题 This question already has answers here : Closed 9 years ago . Possible Duplicate: is “else if” faster than “switch() case” ? I've encountered a lot of situations lately where I have very simple conditionals and need to branch application flow. The "simplest" means of accomplishing what I'm doing is just a plain old if / elseif statement: if($value == "foo") { // ... } elseif($value == "bar") { // ... } elseif($value == "asdf" || $value == "qwerty") { // ... } ...but I'm also considering

git大全转

╄→гoц情女王★ 提交于 2019-11-30 13:20:29
ADD AND COMMIT 1. git init 初始化一个 Git 仓库(repository),即把当前所在目录变成 Git 可以管理的仓库。 2. git add 文件 把文件添加到 暂存区(stage),可被 track 追踪纪录下来。可多次使用来添加多个文件。 3. git add * 添加所有修改到暂存区,效果同 git add all, 待验证 。 4. git add -A 暂存所有的文件,包括新增加的、修改的和删除的文件。 5. git add . 暂存新增加的和修改的文件,不包括已删除的文件。 即当前目录下所有文件 。 6. git add -u 暂存修改的和删除的文件,不包括新增加的文件。 7. git add -i 交互式添加文件到暂存区 。 8. git add -p 暂存文件的一部分 。 9. git commit -m "本次提交说明" 一次性把暂存区所有文件修改提交到仓库的当前分支。注意:提交信息可为中文也可为英文,若为英文则通常用一般现在时。如果不加参数 -m 则会跳转到编辑器强制填写提交说明信息。 10. git commit -am "本次提交说明" 使用该命令,Git 就会自动把所有已经跟踪过的文件暂存起来一并提交,从而跳过 git add 步骤,参数 -am 也可写成 -a -m。“在 oh-my-zsh 下,直接用 gcam

Get git current branch/tag name

限于喜欢 提交于 2019-11-30 13:10:27
问题 How can I get the current branch or tag name for my working copy? I have seen references that indicate rev-parse --abbrev-ref HEAD will give branch name, but this doesn't work if the checkout is of a tag, in which case it just returns 'HEAD'. I need to somehow get the tag name of these revisions. To be clear, I want one of two possible names: If the current checkout is the HEAD of a branch, I want the branch name If it is a detached HEAD, I want the tag name (on the assumption there is a tag)

View TFS checkin history through merges?

人走茶凉 提交于 2019-11-30 12:41:50
问题 In TFS when you merge branch A to branch B and checkin, you get a single changeset on B (typically with a comment like "merged A->B"). This means B doesn't have any of the checkin history from A. So if someone created a new file on branch A, you can't tell who created it from branch B. And if someone updated a file on A, you can't tell who did the update from branch B. Is there any way to see this kind of detailed changeset history across branches? Some kind of power toy, or third party tool,