locked
TFS GIT Usage RRS feed

  • Question

  • I admit I am new to using GIT for version control.  We decided to try using it on a new project.  I created the repository in TFS and have started doing some of the code with a co-worker.  Each time my coworker does a check-in and I do a Sync, his changes appear in my list of changes and then I end up also checking in his changes to the repository.  I have tried to search the internet for information on this to determine if I am doing something wrong or if I have something configured wrong but was unable to find anything.  Can anyone on the form here provide information as to what is happening and what the proper way of supporting this is?
    Wednesday, March 2, 2016 4:37 PM

Answers

  • Upon further investigation it seems that when a ".gitattributes" file gets added to the workspace that I start to see the changes made by other developers when I do a "sync".  If I remove the file then those changes go away and I only see my changes when I do a check-in.
    Friday, March 4, 2016 7:46 PM

All replies

  • Hi A.Gritt,     

    Thanks for your post.

    It seems you’re using the correct steps.

    For more information about how to use GIT in TFS Server, please start from these documents: https://msdn.microsoft.com/en-us/library/vs/alm/code/git/overview.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, March 3, 2016 3:23 AM
    Moderator
  • Upon further investigation it seems that when a ".gitattributes" file gets added to the workspace that I start to see the changes made by other developers when I do a "sync".  If I remove the file then those changes go away and I only see my changes when I do a check-in.
    Friday, March 4, 2016 7:46 PM
  • Hi Acgritt,    

    Thanks for your reply.

    Yes, you shouldn’t remove that file from your workspace folder.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, March 7, 2016 1:58 AM
    Moderator
  • You say that I should not remove that file.  It was not originally added as part of the solution.  It is when I add the file that things get all wonky.  If I don't have the file then everything is working fine and I don't see other developers changes as part of my changes when I do a sync.
    Wednesday, March 9, 2016 7:41 PM
  • It has to do with line ending normalization. Your .gitattributes file probably has something like * text=auto in it. It's a good idea to normalize line endings using .gitattributes, so that the repository will always have LF regardless of git client settings (core.autocrlf). Adding a .gitattributes mid-development, however, is a bad idea and leads to wonky behaviour as you say. If you want to do that now I would probably do a clean break and normalize all the files after the .gitattributes is added. More reading and an example here: http://git-scm.com/docs/gitattributes

    $ echo "* text=auto" >>.gitattributes
    $ rm .git/index     # Remove the index to force Git to
    $ git reset         # re-scan the working directory
    $ git status        # Show files that will be normalized
    $ git add -u
    $ git add .gitattributes
    $ git commit -m "Introduce end-of-line normalization"


    Thursday, March 10, 2016 1:52 AM
  • Thanks Kristian.  This explains exactly what I am seeing now and I now have a better understanding about what I am seeing happening.
    Thursday, March 10, 2016 9:19 PM