git-branch

Git push branch from one remote to another?

送分小仙女□ 提交于 2019-11-27 09:00:41
问题 I have the following remotes set up: $ git remote korg rorg And the following branches: $ git branch -a * (no branch) remotes/korg/gingerbread remotes/korg/gingerbread-release remotes/korg/honeycomb remotes/korg/honeycomb-mr1-release remotes/korg/master remotes/m/android-2.3.3_r1 -> refs/tags/android-2.3.3_r1a remotes/m/gingerbread -> korg/gingerbread Now I wish to push all the remote branches from korg to the rorg remote. How do I do that? Preferably without making a local branch for each

Complex Git branch name broke all Git commands

柔情痞子 提交于 2019-11-27 08:58:01
问题 I was trying to create a branch from master with the following command, git branch SSLOC-201_Implement___str__()_of_ProductSearchQuery when Git suddenly stopped responding. I suspect the unescaped () are to blame, somehow. Now, whenever I try to run any Git command, I get the same error: git:176: command not found: _of_ProductSearchQuery with the number after git increasing every time I type a command. Can anyone explain what happened? And how do I get back to normal? I'd like to delete that

Git merge errors

半城伤御伤魂 提交于 2019-11-27 08:56:59
问题 I have a git branch called 9-sign-in-out with perfectly working code, and I want to turn it into the master. I'm currently on the master branch. $ git branch 9-sign-in-out * master I'm trying to switch to 9-sign-in-out branch, but it doesn't allow me to: $ git checkout 9-sign-in-out app/helpers/application_helper.rb: needs merge config/routes.rb: needs merge error: you need to resolve your current index first Any idea how can I ignore all the master branch errors and turn the 9-sign-in-out

Update Git branches from master

不想你离开。 提交于 2019-11-27 08:56:48
问题 I'm new to Git, and now I'm in this situation: I have four branches (master, b1, b2, and b3). After I worked on b1-b3, I realized I have something to change on branch master that should be in all other branches. I changed what I needed in master and... here is my problem: How do I update all other branches with master branch code? 回答1: You have two options: The first is a merge, but this creates an extra commit for the merge. Checkout each branch: git checkout b1 Then merge: git merge origin

How to create a new branch from a tag?

家住魔仙堡 提交于 2019-11-27 08:55:40
问题 I'd like to create a new master branch from an existing tag. Say I have a tag v1.0 . How to create a new branch from this tag? 回答1: Wow, that was easier than I thought: git checkout -b newbranch v1.0 回答2: If you simply want to create a new branch without immediately changing to it, you could do the following: git branch newbranch v1.0 回答3: I used the following steps to create a new hot fix branch from a Tag. Syntax git checkout -b <New Branch Name> <TAG Name> Steps to do it. git checkout -b

Why doesn't Git remove some files when I switch a branch?

╄→гoц情女王★ 提交于 2019-11-27 06:37:25
问题 I have had this happen to me often. I am working on a master branch and I need to test a plugin, so I create a new branch and check it out. I download the plugin into the project directory and test it out. Then I switch back to the master branch and delete the branch I had created. What ends up happening is the files of the plugin remain in the project directory. I'm wondering if this is normal behavior. What do I have to do in order to have a seamless switch between branches? 回答1: git will

Where does a Git branch start and what is its length?

余生颓废 提交于 2019-11-27 06:31:52
Every now and then I'm asked, on what commit a certain branch on git starts or if a certain commit has been created on a specific branch. The end point of a branch is pretty clear: that's where the branch label sits. But - where did it start? The trivial answer would be: on that commit where we created that branch. But that information is, as far as I know now, and that's why I'm asking the question, lost after the first commits. As long as we know the commit where we branched off, we can draw the graph to make it clear: A - B - C - - - - J [master] \ D - E - F - G [branch-A] \ H - - I [branch

How to create a remote Git branch without creating a local branch?

≯℡__Kan透↙ 提交于 2019-11-27 06:11:21
问题 I'd like to create a new remote branch for later use. The most commonly suggested way seems to be: git checkout -b newbranch origin/startingpoint git push origin newbranch But this will also create the branch locally and put me on it. Is there a way of creating a remote branch without creating it locally and moving onto it? 回答1: tl;dr: specify the full destination refname and you can push a commit directly: git push origin origin/startingpoint:refs/heads/newbranch you can push anything that

How do I commit only some files?

此生再无相见时 提交于 2019-11-27 05:50:54
I have two projects. One is the "official" project and the second is a light modification (some files added). I created new branch and I put new files to them. But in during development some files common to both branches is changed. How do I commit only these files? Alex I suppose you want to commit the changes to one branch and then make those changes visible in the other branch. In git you should have no changes on top of HEAD when changing branches. You commit only the changed files by: git commit [some files] Or if you are sure that you have a clean staging area you can git add [some files

How do I rename both a Git local and remote branch name?

痴心易碎 提交于 2019-11-27 05:46:12
I have four branches like master -> origin/regacy, FeatureA -> origin/FeatureA. As you can see, I typed the wrong name. So I want to rename a remote branch name (origin/regacy → origin/legacy or origin/master) I try the command below: git remote rename regacy legacy But Git console returned an error message to me. error : Could not rename config section 'remote.regacy' to 'remote.legacy' How can I solve this problem? CodeWizard You can't directly rename a remote branch. You have to delete it and then re-push it. Renaming a branch # Rename the local branch to the new name git branch -m <old