git-branch

How to find if a branch is a locally tracked branch or user created local branch?

♀尐吖头ヾ 提交于 2019-12-24 02:33:33
问题 I have a remote tracking branch tracked locally in my local repository using 'git branch -b branch-name origin/branch-name'. My remote branch is test2/test2 (origin/branch-name) which is being tracked locally as test2. The origin is also named test2. I haven't checked-out my local tracking branch test2. When i do a 'git pull origin remote-branch:local-tracked-branch' i get this error [test2]$ git pull test2 test2:test2 From /gitvobs/git_bare/test2 ! [rejected] test2 -> test2 (non fast forward

Pushing a commit to branch of another user who has opened a pull request

人走茶凉 提交于 2019-12-24 02:16:23
问题 I have a repository on github. My repository is forked by another user. Now he has raised a pull request. I would like to push one commit from my end to his feature branch(for which he has raised a PR). Is this possible. Here is what I did git pull remote-ref-other-user feature-branch After doing this I am able to pull his commits. but when I do some change, add another commit and try to push it this way. git push remote-ref-other-user feature-branch I get this error error: src refspec

Does git submodule branch switch along with main project's branch?

谁说我不能喝 提交于 2019-12-24 02:05:33
问题 Recently I got to know git submodules. They appear to be self-sufficient projects with their own git structure and branches. When I switch main project's branch, does this also switch submodule's branch? How does git handle this situation? 回答1: I recently came across a similar question. (I'll let you read the content of this answer as it gives you the background to my answer). A submodule is just a reference to a repo and a commit in this repo. When you switch branch, the reference may change

git log revision range gives incorrect range of commits

和自甴很熟 提交于 2019-12-23 21:04:32
问题 I am trying to use list all commits within a given range on a branch using the argument of git log . For some reason it doesn't seem to be giving me the right result (or maybe I'm understanding the command wrong?). Here's the steps for what I'm doing: Clone the repo git clone https://github.com/openstack/nova.git Do git log and these are the last 9 commits: d5bde44 Merge "Make metadata password routines use Instance object" 6cbc9ee Merge "Fix object change detection" 39b7875 Merge "Fix object

Why do I need Root privilege to do `git branch -a`?

僤鯓⒐⒋嵵緔 提交于 2019-12-23 09:25:10
问题 The git repository is under my username nikhil and group nikhil as follows: $ ls -l drwxr-xr-x 10 nikhil nikhil 4096 Sep 1 12:33 CS/ I can get git status as git status without root privilege. But when I try to list branches: $ git branch -a nothing happens. Also, with root priviledge: $ sudo git branch -a [sudo] password for nikhil: * master remotes/origin/feature remotes/origin/master it does lists all my repository. Why is it so? Edit: output of ls -lh .git $ ls -lh .git total 332K drwxr-xr

Backmerging a stitched up feature branch with clean history

拥有回忆 提交于 2019-12-23 02:46:25
问题 I have this d0 ----- | \ | ------ f1 d1 | | | | | d2------ f2 | \ | | \ | d3 \ | | --- merge | | d4 --- f3 \ | \ | \ | ----- merge | | f4 No, really. I actually made a repo like this. Note that I had to fix a merge conflict between d3 and f3. C:\dev\git-test> git tree * 9a169c2 (HEAD, feature) f4 * 1396e5c fixed master -> feature merge conflict |\ | * 7ececbd (MASTER) d4 | * a2be7eb d3 * | 8c11a80 f3 * | caa9068 Merge branch 'master' into feature |\ \ | |/ | * 576ac31 d2 | * fe78786 d1 * |

Separate branches or git projects?

北城余情 提交于 2019-12-23 02:38:29
问题 I'm introducing Git in our company. I have several applications that all interact together via sockets, and now, it is about to decide whether I should use separate branches for different parts of my application, or separate Git projects. I also want to use tags for revisions; if I use branches, I have to tag like branchnameV1.0, but if I use separate Git projects I could tag like v1.0`. What would be the most conventional method for doing this? 回答1: Separate Git projects: branches are

Git Merging - what happens to 2 branches being merged at same time

百般思念 提交于 2019-12-23 02:33:05
问题 I have an unclear understanding about merging on git, which I would like to understand correctly. Let's say, I have a file F on master branch, which has already 100 LOC. I create a branch A from master, and I write 50 LOC, starts from line 101th to line 150th. I create a merge request to merge branch A to master. So if branch A will be merged, then file F on master will have 150 LOC Let's assume branch A isn't merged to master yet, still waiting. And I create a new branch B from master. I

Proper version control workflow for a mixture of repositories

僤鯓⒐⒋嵵緔 提交于 2019-12-23 02:32:21
问题 Would appreciate your feedback on the following (I'm a Git beginner). I have a public repo on GitHub for my dissertation study's artifacts (mostly software, written in R ). I'd like to adapt a third-party GitHub repo, containing LaTeX dissertation template (basically, I want to periodically sync with it, merging changes, which I want/need). I've created corresponding submodule for the manuscript within my main project directory structure. However, now I questioning whether this route is the

How can I pull from one remote and push to another with git?

谁说我不能喝 提交于 2019-12-23 02:22:35
问题 I have a contributor to my github repository who has a fork and is working on a branch. I want to pull their branch to my own branch and make modifications, but still track theirs. Can I configure git so that while I'm on branch foo , git pull pulls from contributor/foo and git push pushes to origin/foo This is similar to but distinct from the question How can I push to one url and pull from another using one remote? because that question is looking to use the same remote name. 回答1: You can