How do I fetch all Git branches?

TL;DR answer git branch -r | grep -v ‘\->’ | sed “s,\x1B\[[0-9;]*[a-zA-Z],,g” | while read remote; do git branch –track “${remote#origin/}” “$remote”; done git fetch –all git pull –all (It seems that pull fetches all branches from all remotes, but I always fetch first just to be sure.) Run the first command only if there … Read more

How can I save username and password in Git?

Attention: This method saves the credentials in plaintext on your PC’s disk. Everyone on your computer can access it, e.g. malicious NPM modules. Run git config –global credential.helper store then git pull provide a username and password and those details will then be remembered later. The credentials are stored in a file on the disk, … Read more

Pull latest changes for all git submodules

If it’s the first time you check-out a repo you need to use –init first: git submodule update –init –recursive For git 1.8.2 or above, the option –remote was added to support updating to latest tips of remote branches: git submodule update –recursive –remote This has the added benefit of respecting any “non default” branches … Read more

Make .gitignore ignore everything except a few files

An optional prefix ! which negates the pattern; any matching file excluded by a previous pattern will become included again. If a negated pattern matches, this will override lower precedence patterns sources. # Ignore everything * # But not these files… !.gitignore !script.pl !template.latex # etc… # …even if they are in subdirectories !*/ # … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)