Using git-tfs fetch to get the latest reasons for merge conflict

I have a problem trying to pull the latest changes from TFS and add them to the BitBucket repository. I have successfully injected my branches into BitBucket, but when I try to get any new checks from TFS, I always get a merge conflict.

Steps:

  • git tfs clone http://TFS-ADDRESS/Collection $/Project/Name/Branch
  • git tfs init-branch $/Project/Name/NewBranch NewBranchName
  • git push -u origin --all

At this point, my BitBukcet relay has all my files and history from TFS. Then I checked me $ / Project / Name / NewBranch on TFS.

Now I want to get the latest changes from TFS and add / copy them to the BitBucket repository. Note. At this point, no other branch in TFS or BitBucket has changed. The only change is my only registration in TFS

When I do the following on my NewBranch, I get a merge conflict:

 git tfs pull Auto-merging Source/build.version CONFLICT (content): Merge conflict in Source/build.version 

As far as I can tell, he is trying to merge the changes from my “wizard” to my “NewBranch”, although NewBranch is the latest code. The ptfs pull command pulls the last checgeset down, but then tries to merge. If i use

 git tfs fetch --all 

I see the list of changes indicated in the list, but I cannot commit it to the BitBucket repository. I cannot find the link on the Internet to say what I am doing wrong, or what steps I need to take (I'm new to Git). Can anyone help?

Ultimately, I want to automate this, so any checks in TFS can be extracted and added to the BitBucket repository (until we move all the developers to BitBucket)

thanks

EDIT I'm trying to accept changes from TFS to BitBucket. Nothing is added to TFS from BitBucket.

All work is performed on a branch (see below). Users work in TFS. Users commit their changes there. NOTE. No one is making changes to the BitBucket repository. This is a copy of TFS. Once a day, I want to pull the latest changes for each TFS branch to my local git folder, and they paste them into BitBucket. "git tfs fetch" fetches the changes:

 D:\development\workspaces\git\anothertry>git tfs fetch --all C83419 = 3abdaedf571369dce15f74a52697d86069f87d6d 

but "git status" tells me that nothing to commit

 D:\development\workspaces\git\anothertry>git status # On branch Feature nothing to commit, working directory clean 

And when I try to push this set of changes to BitBucket, git tells me there is nothing to do.

Industries

 Master---o---------------o----o--oo--o------- \ / / / / / Feature-----o----o--oo--o 
+6
source share
3 answers

I seem to have found the answer after using Git Extensions.

I think I need to make a selection

 git tfs fetch --all 

This will give me all the changes in TFS for my trunk and any branches I have displayed (init-branch)

 D:\development\workspaces\git\anothertry>git tfs fetch --all C83454 = f65ba8d0cc7b40f42148ba2c06d0da8b7e968c4d C83455 = 6c25feb6e74a09d0d3d84344002e7546044900ab C83459 = 91c4450d702d5a97e862aedd7ad1b5af3ff2c375 C83460 = 5cacaba5bfe4197c1bf9fab498f51c1ba435e6ea 

Next I need to merge

 git merge <guid> 

NOTE. For the latest set of changes (in this case 5cacaba ...)

 Updating 6c25feb..5cacaba Fast-forward Source/Common/w32threads.h | 1238 ++--- Source/xxxxxxx_Service/ServerAgent.cpp | 3638 ++++++------- Source/xxxxxxx_Service/ServerAgent.h | 449 +- Source/xxxxxxx_Service/User.cpp | 9073 ++++++++++++++++---------------- Source/xxxxxxx_Service/User.h | 647 +-- Source/build.version | 2 +- 6 files changed, 7562 insertions(+), 7485 deletions(-) 

Finally, click my changes to BitBucket

 git push --all 

So, it seems that I am missing a call to git merge and parameters to pass it.

Greetings

+2
source

I don’t quite understand what you are doing badly, but there is something you should use git-tfs now ...

  • Working with the TFS branch I see that you created the branch (step 2) and committed to this branch. When you checked your "NewBranchName" branch, you should check with the command:

    git tfs rcheckin -i NewBranchName

and pull the modifications with:

 git tfs pull -i NewBranchName 

or (with rebase)

 git tfs pull -r -i NewBranchName 

If you do not specify the -i option with the name of the TFS remote, you will check the commit in the main branch (here $ / Project / Name / Branch): (

  • Check your commits on TFS I give you a command to check your commits. But you should know that for some reason, when you check the git commit in TFS, a new set of changes to TFS is created (what we want;)) and after creating a new git commit. This is almost the same as the original, but with some information (which you can see in the git comment). Because of this, depending on what you are doing (and I don’t understand exactly), you may have problems because git is trying to combine the commit with the exact same changes in the same place, so the merge cannot be automated .

In fact, I think that something is wrong in your workflow, because you should not face this problem. Try to find a problem in your workflow.

Hope this helps.

Feel free to see the wiki git -tfs: https://github.com/git-tfs/git-tfs/wiki I hope there is some pretty useful information (this partly happened, with love;))

PS: To help you better, can you tell me which command you use to check your commits? checkin, checkintoo, rcheckin? rcheckin is highly recommended!

What I do to automate the workflow:

(here “bitbucket” is the intended name of your remote Bitbucket repository)

=> in the main branch:

 //Do your job & commit with git & ... //rebase your work on TFS work git tfs pull -r //rcheckin with git-tfs git tfs rcheckin //commit in bitbucket repo git push bitbucket master 

=> in the "NewBranchName" branch:

 //Do your job & commit with git & ... //rebase your work on TFS work git tfs pull -r -i NewBranchName //rcheckin with git-tfs git tfs rcheckin -i NewBranchName //commit in bitbucket repo git push bitbucket NewBranchName 

PS2: You may need to apply your changes if you have undefined changes to the working directory before doing pull -r and rcheckin ...

EDIT: you are editing, I am editing;)

I used to assume that you defined a remote file for your bitpack repository:

 git remote add bitbucket https://bitbucket.org/yout_login/your_project.git 

You only have:

 //checkout your branch git checkout NewBranchName //fetch the TFS changesets and merge your branch into git tfs pull -r -i NewBranchName //push your commit on bitbucket git push bitbucket NewBranchName 

And to explain a little what you are doing (and do not fully understand: () ...

With git tfs fetch -all "you retrieve a set of TFS changes for all branches, but do not merge (or restore) your local branch. Therefore, they do not appear in your local branch. You can see the DAG with the command to better understand:

 git log --oneline --graph --decorate 

The above 'git tfs pull' merges the fetched commit with your branch to make it good!

"git status" tells me there is nothing to do

This command shows you files that have been modified in the working directory. So, it is normal that you do not see any changes. This suggests that your commit was not pulled out!

And when I try to push this set of changes to BitBucket, git tells me there is nothing to do.

You must have! Are you sure you defined your remote control in your bitbucket repository? (see above) Which command are you using? What will git tell you?

0
source

The git tfs fetch command does not update the local git repository, so after that you should do git merge .

To do the same in one command, just pull out the TFS remotes

 git tfs pull -r 

This should update the local git repository with all new updates from the TFS server

At this point, you just need to push the updates to git server:

 git push -u origin --all 
0
source

All Articles