0

I was facing serious problem earlier. Problem is that GitHub Pull Request showing files changes rewritten all files except the some changes made in existing file.

I am using Visual Studio 2015 for commit and fetch changes, and using Command window for git pull. If anything need more clarity, please let me know.

Steps followed:

  1. git checkout APPROVED (My origin branch)

  2. git pull APPROVED (My origin branch)

  3. git checkout -b in### (Created a local branch for urgent fix )

  4. Start work Then...

  5. before publish to GitHub...

  6. git pull APPROVED (My origin branch)

  7. git checkout in### (Local branch )

  8. git merge APPROVED

  9. Commit and publish

  10. complete testing and make pull request into indev

melpomene
  • 84,125
  • 8
  • 85
  • 148
Vivek Shukla
  • 1,535
  • 1
  • 13
  • 13
  • The actual problem is there , once i am making any pull request against my base branch , it showing file changes that i committed ,this is fine , but it looking all files is rewritten except the changes i made in that file . – Vivek Shukla Jun 17 '17 at 09:01

1 Answers1

1

If you want to do any pull request, you have to do so in a dedicated branch.

If the files appear "completely changed" when making a pull request within your own repo, this is typical of the core.autocrlf setting: if set to true, Git would change on checkout the end of lines characters automatically to CRLF.

A simple git config --global core.autocrlf false is enough, and is taken into account by Visual Studio

From there, make a new branch:

git checkout -b aNewBranch
# edit, add, commit push

A Pull Request done from that new branch to 'dev' branch will show only your modifications (and not "everything changed").

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • My issue is something different , i am not getting any issue with Push and commit ,issue i am facing , when i am looking the file changes on Pull Request , it looking like all file that is published in commit is rewritten , but i have just make 2 or 3 line changes in that file ,but looking all changes . – Vivek Shukla Jun 17 '17 at 14:29
  • @vivek Exactly. Hence my suggestion to start over: see if your issue persists after following my steps – VonC Jun 17 '17 at 15:44
  • it just removed all my local changes pushed in origin branch , this is not something i want to achieve . may be something else going wrong . – Vivek Shukla Jun 18 '17 at 12:00
  • We're your local changes committed? – VonC Jun 18 '17 at 12:05
  • Yes , i have committed changes already ,and make pull request for that as well , it is showing only committed only on origin repo , only problem is that committed files looking all code is rewritten , i have just make 2 line changes in working js file . i am surprised ,why it showing all files is rewritten , my client just cancelled all my pull request . – Vivek Shukla Jun 18 '17 at 12:11
  • now i am taking checkout again of that branch and looking like ,all my changes made in previous commit are removed now by git rebase origin branch name , right ? it means i have lost my changes that made earlier . – Vivek Shukla Jun 18 '17 at 12:22
  • @vivek the git rebase must replay your commit on top of upstream/master: do a git log locally to confirm that: if you follow those steps, your PR will work. – VonC Jun 18 '17 at 12:49
  • ,It looking changes are removed ,it come on my previous branch , which do not have last committed files . – Vivek Shukla Jun 18 '17 at 12:55
  • @vivek If you have TeamViewer installed, I can open an interactive session and have a look: http://www.teamviewer.com/ – VonC Jun 18 '17 at 13:05
  • it would be a great help , add me on Skype , we can go through screen sharing . Vivekshukla406@gmail.com add me skype , i have TeamViewer as well . – Vivek Shukla Jun 18 '17 at 13:10
  • @vivek No problem. I just rewritten the answer to better reflect the eol (end of line) issue – VonC Jun 18 '17 at 14:02
  • @vivek Yes, I have edited the answer already. Can you have a look? – VonC Jun 18 '17 at 14:27
  • ,yes you described well the issue ,i was facing , it really saved me , i have wasted a lot of time for fixing this , finaly we have fixed this issue . thanks you . – Vivek Shukla Jun 19 '17 at 03:37
  • same issue i am getting again , doing above steps but problem still persisting . problem is that core.autocrlf is showing two times now . first core.autocrlf false and second true that creating problem for us . – Vivek Shukla Jun 25 '17 at 16:06
  • @vivek First, you can do a `git config -l --show-origin`: that will list *all* settings and will tell you where they are. Then you can edit directly the right file and remove the setting where `core.autocrlf` is set to `true`. – VonC Jun 25 '17 at 16:31
  • same things happening when i was taking update for Entity file . all my store procedure showing changes , i have tried to look the changes in those file then found there is one extra line that causing problem and looking all store procedures have changes . Is there setting options for this , on other machine ,there is no such problem , – Vivek Shukla Jun 25 '17 at 19:09
  • @vivek a good way to enforce that for all repos for all users on a given machine is to set the config at the system level: git config --system core.autocrlf false. Then make sure the global setting has no core.autocrlf: git config --global -l. Finally, clone a repo. – VonC Jun 25 '17 at 19:23
  • @vivek Sorry, I am no longer on holidays ;) Can you ask a new question describing the situation: I will answer it (or, more importantly, others will too) – VonC Jun 26 '17 at 04:13
  • please look this one , if more clarity needed ,please let me know , i have gone through above your comment but my problem still persisiting , please try to help me https://stackoverflow.com/questions/44747909/visual-studio-update-model-from-data-base-issue – Vivek Shukla Jun 26 '17 at 04:30
  • Issue with my source is fixed ,but same thing happening with my entity classes , i am getting surprised , why it happening in my case , i seeing there is no issue to others like me . – Vivek Shukla Jun 26 '17 at 04:33