git - Bitbucket CRLF issue? -


issue: bitbucket shows entire file has changed though dont see differences. , there no merge conflicts in these files.

details: created sprint branch (named "sprintbranch") , developers created feature branch(named "featurebranchx") sprint branch. started merging feature branches sprint branch , when features implemented. there 2 scenarios face issue:

  1. developer creates pull request merge featurebranch1 sprintbranch
  2. if there merge conflicts, developer merges sprintbranch featurebranch1 , creates pull request merge featurebranch1 sprintbranch.

both times bitbucket shows entire file has changed. , there no merge conflicts.

when happens, cannot code review since dont know specific lines have been modified developer. lose history @ point - looking wont able figure out implemented or merged sprint branch.

my guess issue line endings. crlf. when commit work see appropriate line endings being used automatically (either git or tool smartgit)

how resolve doesnt keep happening?

update:

i found out can append query string w=1 @ end of url of pull request ignore cr lf differences.

but these files still there in commit , when merge back, include differences right?

even though bitbucket can ignore whitespace in diffs (using w=1 query parameter), changes still included in merge.

but can configure git convert line endings either lf or crlf. team should first decide option be, , set text property in .gitattributes file accordingly, so:

* text eol=lf 

this github page shows more information. (the information git in general, not github.)

you need global configuration option git config --global core.autocrlf input (mac & linux) or git config --global core.autocrlf true (windows).

# make sure won't loose work in progress $ git add . -u $ git commit -m "saving files before refreshing line endings"  # remove every file git index $ git rm --cached -r .  # rewrite git index $ git reset --hard  # prepare changed files commit $ git add . # safe see lot of messages here read # "warning: crlf replaced lf in file."  # , commit. $ git commit -m "normalize line endings" 

more information available in github article.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -