git-branch

git checkout --ours does not remove files from unmerged files list

*爱你&永不变心* 提交于 2019-12-17 17:31:51
问题 Hi I need to merge two branches like this. This is just an example what is happening, I work with hundreds of files which need resolution. git merge branch1 ...conflicts... git status .... # Unmerged paths: # (use "git add/rm <file>..." as appropriate to mark resolution) # # both added: file1 # both added: file2 # both added: file3 # both added: file4 git checkout --ours file1 git chechout --theirs file2 git checkout --ours file3 git chechout --theirs file4 git commit -a -m "this should work"

Having a private branch of a public repo on GitHub?

社会主义新天地 提交于 2019-12-17 10:08:45
问题 I have a public PHP project in a GitHub repo, which contains just one branch (master). I want to have a separate branch/fork that is private for me (I have paid for private GitHub repos). I would like to be able to merge changes from the private branch/fork to the public repo, and vice versa. With that in mind, here are my questions: Can I have a private branch on a public repo? Can I fork my own public repo into my own private branch/fork? If both of the above are possible, which is the best

Git branch name - case sensitive or insensitive?

一笑奈何 提交于 2019-12-17 09:49:55
问题 I am a new git user and recently been handed with an out of date git repository to look after. This is the original state ( output by git show-branch): ! [cr232] CR 232 Release * [dev] Style Changes --------------- * [dev] Style Changes * [dev^] SMS 5.4 * [dev~2] Logo Change * [dev~3] SMS 5.3 * [dev~4] SMS 5.2 * [dev~5] SIT R-0.3.3 EDW SMS Layers * [dev~6] SIT Release R 0.3.0 +* [cr232] CR 232 Release +* [cr232^] Dashboard Fix +* [cr232~2] Release for system testing Note that there is a

What is the difference between “git branch” and “git checkout -b”?

两盒软妹~` 提交于 2019-12-17 07:00:05
问题 I used git checkout -b to create a new branch. I think that git branch does the same thing. How do these two commands differ, if they differ at all? 回答1: git checkout -b BRANCH_NAME creates a new branch and checks out the new branch while git branch BRANCH_NAME creates a new branch but leaves you on the same branch. In other words git checkout -b BRANCH_NAME does the following for you. git branch BRANCH_NAME # create a new branch git checkout BRANCH_NAME # then switch to the new branch 回答2:

Git fetch remote branch

大城市里の小女人 提交于 2019-12-17 04:37:08
问题 My colleague and I are working on the same repository. We've branched it into two branches, each technically for different projects, but they have similarities, so we'll sometimes want to commit back to the * master from the branch . However, I have the branch . How can my colleague pull that branch specifically? A git clone of the repository does not seem to create the branches locally for him, though I can see them live on unfuddle after a push on my end. Also, when I originally made the

Show just the current branch in Git

主宰稳场 提交于 2019-12-17 00:27:51
问题 I tried looking for a special Git command for this, but I couldn't find one. Is there anything shorter or faster than the following? git branch | awk '/\*/ { print $2; }' 回答1: $ git rev-parse --abbrev-ref HEAD master This should work with Git 1.6.3 or newer. 回答2: In Git 1.8.1 you can use the git symbolic-ref command with the "--short" option: $ git symbolic-ref HEAD refs/heads/develop $ git symbolic-ref --short HEAD develop 回答3: With Git 2.22 (Q2 2019), you will have a simpler approach: git

How do I rename a local Git branch?

扶醉桌前 提交于 2019-12-16 20:01:49
问题 I don't want to rename a remote branch, as described in Rename master branch for both local and remote Git repositories . How can I rename a local branch which hasn't been pushed to a remote branch? In case you need to rename remote branch as well: How do I rename both a Git local and remote branch name 回答1: If you want to rename a branch while pointed to any branch, do: git branch -m <oldname> <newname> If you want to rename the current branch, you can do: git branch -m <newname> A way to

How to replace master branch in Git, entirely, from another branch? [duplicate]

狂风中的少年 提交于 2019-12-16 19:58:47
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Make the current Git branch a master branch I have two branches in my Git repository: master seotweaks (created originally from master ) I created seotweaks with the intention of quickly merging it back into master . However, that was three months ago and the code in this branch is 13 versions ahead of master . It has effectively become our working master branch as all the code in master is more or less obsolete

How to replace master branch in Git, entirely, from another branch? [duplicate]

送分小仙女□ 提交于 2019-12-16 19:57:03
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Make the current Git branch a master branch I have two branches in my Git repository: master seotweaks (created originally from master ) I created seotweaks with the intention of quickly merging it back into master . However, that was three months ago and the code in this branch is 13 versions ahead of master . It has effectively become our working master branch as all the code in master is more or less obsolete

How to know working directory refers to which branch in git?

孤街醉人 提交于 2019-12-14 04:10:10
问题 According to some researches I figured it out that git keeps two version of the code in two places: .git/refs/heads (local repository) .git/refs/remotes/ (working directory) First of all, is my understanding ok? Then I need to know both head and working directory are referring to which branch. There are two commands: cat .git/head git branch Can you please tell me those two commands refers to which one? (either the branch that is in the head or the branch that is in the working directory ) ?