• Home
  • Contact
  • Inspirational
  • Programming Languages
  • Recent findings…

Learners Guide

~ Survivors of Programming Era

Learners Guide

Category Archives: Git

Github Untracking File from Git still keeping file in Remote Repository

08 Tuesday Apr 2014

Posted by learnersguide in Git

≈ Leave a comment

Tags

assume-unchanged, untrack file

Recently i faced with a situation where i need to have the file in repository but we don’t want the changes to be pushed. The situation was this our application makes use of a server and that file is for server connection. so when we try to run it locally we need to change the configuration IP address in that file. But i don’t want that changes to be pushed. Because i’ll use my system ip address and others ‘ll change it to their’s. but still we need that file in repository.

This command does that awesome thing

git update-index --assume-unchanged <filename>

This command simply sets a bit “assume unchanged”, which if set git won’t track the modifications pushing won’t take this

But the issue is everyone who cloned your repository or working on the repository have to run this command, if not when they push it it’ll be affecting file in remote repository.

To view the files like these, that is untracked [assuming unchanged]

git ls-files -v | grep '^[[:lower]]'

git-ls-files shows information about files in the index and the working tree

-v option tells the command to use lowercase letters for ‘assume unchanged’ files.

Normally git ls-files lists all files in tree. you can do git ls-files and search for first letter ‘h’ results in the file. you can also use ‘^[a-z]’ or ‘^h’ for grep finding pattern that filters the result.

when you want to remove the file from untracking

git update-index --no-assume-unchanged <filename>

This unsets the “assume unchaged” bit and git starts tracking it.

More Information:

  • https://www.kernel.org/pub/software/scm/git/docs/git-update-index.html
  • https://www.kernel.org/pub/software/scm/git/docs/git-ls-files.html
Advertisements

Share this:

  • Share on Facebook (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on Google+ (Opens in new window)
  • Click to share on Flattr (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Tumblr (Opens in new window)

Like this:

Like Loading...

Recent Posts

  • Decorator in Python | Tracking method calls
  • Hosting openshift bottle app with mongodb
  • Psql Horizontal Table Display And Editor
  • Python List Mutating while looping over elements

Archives

  • May 2016
  • March 2016
  • November 2015
  • March 2015
  • February 2015
  • December 2014
  • November 2014
  • October 2014
  • September 2014
  • May 2014
  • April 2014
  • March 2014
  • February 2014
  • January 2014
  • December 2013

Categories

  • functional Programming
  • Git
  • IDE
  • Inspirational
  • Java
  • Mac
  • mongodb
  • Openshift
  • Programming Languages
  • Python
  • Scala
  • Shell Program
  • Ubuntu
  • Unit Testing
Advertisements

Recent Posts

  • Decorator in Python | Tracking method calls
  • Hosting openshift bottle app with mongodb
  • Psql Horizontal Table Display And Editor
  • Python List Mutating while looping over elements
  • Restarting Node Server With fswatch command

Blog at WordPress.com.

%d bloggers like this: