Loading...
 

Git


Git Config

  • Ignore File Mode Changes:
    • This is especially necessary for me because I frequently keep my git working directories in a CIFS file share that is mounted on my linux box with 0777 file and directory permissions. I do this to make sharing a central CIFS share between windows and linux a little easier. However 0777 can be problematic every time I clone a repo and the file mode of all of the files changes, the Git client immediately thinks that all of the files have changed.
    • I also discovered that the 'git' client will override the global setting each time it clones a repo. So setting this global parameter seems to only apply when doing a 'git init && git add && git checkout' ..... etc.
      git config --global core.fileMode false
    • I also tried someone else's suggestion to create a wrapper around the 'git clone' command. While this seemed to work, you ended up with two core.filemode=X config parameters, one that was true and one that was false. Definitely not optimal.
      # .bashrc
      
      # bash function to override git clone
      git(){
        case $* in
          clone* ) shift 1; command git clone --config core.filemode=false "$@" ;;
          * ) command git "$@" ;;
        esac
      }
    • At the end of the day I'm just having to manually set this parameter for each repo that I clone........

Git Usage

Sparse Checkout

[+] Standard Sparse Checkout

[+] Sparse Checkout with Submodules

Submodules

  • Updating Submodules
    • 'cd' to the submodule directory and pull
      git checkout master
      
      git pull
    • 'cd' back to the main repo directory and push the submodules changes
      cd ../
      
      git add --all
      
      git commit -am "updating submodules"
      
      git push
  • Removing Submodules
    • De-init the submodule
      git submodule deinit -f -- <submodule_name>
    • Run
      git rm --cached <submodule name>
    • Delete the relevant lines from the .gitmodules file.
    • Delete the relevant section from .git/config.
    • Delete the now untracked submodule files.
    • Remove directory .git/modules/<submodule name>
    • Commit














Show php error messages