Skip to content

Saying to git to ignore some files or folders

File(s) .gitignore allow to define which files or folder should not be take in account by git.

Syntax

TODOC

Tips

Having a standard way to manage .gitignore files

LC_ALL=C sort .gitignore | uniq | grep -Ev "^$" >.gitignore.tmp ; mv -f .gitignore.tmp .gitignore ; echo ''>>.gitignore

You can add following code to you ~/.bashrc

function gitignore_standard {
  if [ -f '.gitignore' ] ; then
    LC_ALL=C sort .gitignore | uniq | grep -Ev "^$" >.gitignore.tmp ; mv -f .gitignore.tmp .gitignore ; echo ''>>.gitignore
  else
    echo "*** Not file .gitignore in current folder." >&2
  fi
}