I have a branch B which is originated from branch A. I make 3 commits named c1, c2, c3 to branch A and then merge with branch B (using the wizard). But in source control explorer I don't seem to be able to see the 3 commits that I've made in B.
The history for branch A is:
c0 c4(merge with branch B)
^
|
|
here I expected to see c1, c2, c3
In git, we could see those using git log . How can I see them in tfvc? Are they there and just hidden or just doesn't care about those changesets.
Bottom line is I've seen pictures when there are tiny triangles on left side of each changeset in source control manager which shows the child branch commits on click. How can I have the same thing with TFVC?
thanks for your time.
-- I expected to be able to see all of the commits in branch B to be visible after merging in branch A.
Related
How do I unmerge/remove a previously added branch from a base branch without deleting the merged branch?
Here is the scenario:
Long back I have merged a branch (x) to a base branch (b), since then I have many branches (y, z, ...) to b and have several commits and pushes. Now I need to remove the changes of x from b without deleting b. So that later if required I can merge that branch again and the changes of x are there in b after merge.
Is it possible or do I need to remove my changes in some other branch (o), which will override the changes of x in b.
On my local repository, I created a branch A from branch B. I did some work on branch A, and pushed A to github.
Then I created a pull request on github, in order to merge branch A into branch B, I heard that it is said to be "branch A is pulled from branch B". Is it correct?
Doesn't a pull request mean merging branch A into branch B?
What does "pulling" branch A from branch B mean?
It seems to me that the two meanings of a pull request are contrary to each other.
If you merge A into B it will be:
Branch A is pulled into B.
or
Branch B is pulled from A.
It refers to the branch you're currently at. If you're in branch B and pull from A, that pull will first fetch A and then merge A.
Pull and Merge are two different process.
"branch A pull from branch B" means you make a editable copy, call it A, from B (If A originally not exist).
"Merge A into B" means you are applying all the changes you made in A back into B
the reason people saying that "branch A is pulled from branch B" is because if A is not pull from B, it can not be merged back to B
There are two different uses of 'pull' in git terminology and, while not contradictory, they can be confusing at first.
1. Pull:
From the command-line command git pull (also known as a combination of fetch and merge). Essentially just gets the remote code (or 'pulls' it to your computer) and merges it into your local code. Read more here.
2. Pull request:
When you want to merge your changes into the repo. Generally opens a discussion and review of your changes before the pull request (or 'PR') is accepted. Read more here.
As an aside, there is also a 'push' command, which may make things clearer (and reiterate the direction pushing and pulling to and from local and remote repos). git push 'pushes' your commits from local to remote (i.e. the opposite of #1, git pull). Read more here.
In git using eclipse i want to current commit of one Branch to the previous version different Branch.
Using "Compare With" option in eclipse, i was able to compare with different branch or with same branch previous versions. But i want to compare with different branch's previous version.
For e.g Branch A has 3 commits aa ab and ac.
Branch B has 3 commits ba bb and bc.
I want to compare branch B's bc commit (latest) with Branch A's aa commit (not with command line)
It appears that the eGit plugin supports what you want to do:
Comparing Two Commits
Select a resource in the Package Explorer
click Team > Show in History or Compare With > History... (the latter for files only)
in the commit graph select two commits
right-click Compare with each other
this will open a compare dialog showing the changes between the two selected commi
you can also open a Git Tree Compare view by right-clicking Compare with each other in Tree
The trick will be in finding the commit graph view so that you can manually choose the bc and aa commits from your two branches.
Project file - Right Click -> Team -> Show in history
ctrl+click the two versions you would like to compare
Right Click -> Compare with each other
This will bring up the two versions you would like to compare
Recently I had a lot of success rebasing a local-only repository while changing commit messages and after that only the commit messages had been changed but the history itself hasn't.
Now I have my repositories - remotely and locally. I made several commits on several branches and already pushed them. Due some reasons I need to change some commit massages over several branches and tried to use rebase interactive like before. But the commits appeared at the end of the current checked out branch.
(I know how to and I had reset my repositories to the state before rebasing.)
After some reading I realized the problem is the commits had been pushed already which wasn't the fact in my local-only repository.
I tried to rebase the remote repository, but it's a bare one - so it didn't work.
I know its not recommended. But for learning purposes I really like to know how to change several commit messages without resulting in duplicate commits at the end of my branch / repository.
(I don't like this solution: copy and to change my local repository to a bare one as my new remote repository, which would solve my problem.)
I hope I made myself clear enough. Thanks.
Changing the commit message results in changing the commit's hash value and this means all following commits have to change their hashes too (as the parent is included in the hash computation, as the message itself is too).
This is why rebasing is typically only allowed in local branches. Many or say most git remote repositories permit rewriting the pushed history as anyone could have downloaded it already and would then work on a outdated history/branch/commit.
Strategy for preventing or catching git history rewrite
However if your server does allow history rewrites (e.g. if you are the only one working on it) you may push them with --force.
As a side note see here https://stackoverflow.com/a/5668050/1756183
Edit rebase with several branches:
C1 <- C2 <- C3 (branch1)
rebasing children of C1 results in
C1 <- CR2 <- CR2 (branch1)
But if you have:
/ C4 <- C5 (branch2)
C1 <- C2 <- C3 (branch1)
rebasing will most likely lead to:
/ C2 <- C4 <- C5 (branch2)
C1 <- CR2 <- CR3 (branch1)
the reason is that C2 is still the parent of C4, the "fixed" commit CR2 is only related to the rewritten Branch branch1.
If you want to "forget" C2 you have to rebase C4 on top of CR2 (you ll have to play around with rebase --onto). After that C2 is not adressed as anyone's parent or on any branch and will not be shown in the history (although it is still there until garbage collected).
Say, I have three branches, Branch b0, b1 and b2.
b1 is forked some years back from b0 and b2 recently from b1.
All changes done on branch b2 are done by me and another developer, now what I need to do is to merge all my changes to branch b0.
I see two ways of doing it:
Manually copy-paste code (as code additions are quite independent) or
Create a diff file of Current state of branch b2 to the state where b2 was forked from b1. Apply the patch to b0, and manually handle conflicts.
2nd way seems more feasible to me, the only problem I have is how do I create a diff of all changes done on a branch?
Any other better way of doing this are also welcome.
Thanks,