Table of Contents

Local git repo sync with github

When we want to have different file content in local repo (example robots.txt file on live server) than the one on github repo

  1. Make the changes on server
  2. git update-index –assume-unchanged filename
  3. Check if modification is tracked with git status (shouldn't be)
  4. Additionally, we can check the list of assume-unchanged files with:
git ls-files -v|grep '^h'

When we want to make sure cross-platform file permission settings are not tracked as modified files by git:

Set filemode to false (filemode = false) in .git/config file. This file is not shared, so make sure to change wherever necessary (server)

When line ending cross-platform differences are causing git to modify files (Warning: LF will be converted to CRLF or vice-versa):

We can change config settings on each repo, or better yet, using shared .gitattributes file

More info here https://help.github.com/articles/dealing-with-line-endings/

Sample .gitattributes file when we want to force LF line endings here: https://gist.github.com/dpalomar/ebc64d6f56cfc25a3e5c20fe7cdfbd4f

Tested on

See also

References