Where is the global git config data stored?

Update 2016: with git 2.8 (March 2016), you can simply use: git config –list –show-origin And with Git 2.26 (Q1 2020), you can add a –show-scope option git config –list –show-origin –show-scope You will see which config is set where. See “Where do the settings in my Git configuration come from?” As Stevoisiak points out … Read more

What is HEAD in Git?

You can think of the HEAD as the “current branch”. When you switch branches with git checkout, the HEAD revision changes to point to the tip of the new branch. You can see what HEAD points to by doing: cat .git/HEAD In my case, the output is: $ cat .git/HEAD ref: refs/heads/master It is possible … Read more

How to list branches that contain a given commit?

From the git-branch manual page: git branch –contains <commit> Only list branches which contain the specified commit (HEAD if not specified). Implies –list. git branch -r –contains <commit> Lists remote tracking branches as well (as mentioned in user3941992’s answer below) that is “local branches that have a direct relationship to a remote branch”. As noted … Read more

How do I copy a version of a single file from one Git branch to another?

Run this from the branch where you want the file to end up: git checkout otherbranch myfile.txt General formulas: git checkout <commit_hash> <relative_path_to_file_or_dir> git checkout <remote_name>/<branch_name> <file_or_dir> Some notes (from comments): Using the commit hash, you can pull files from any commit This works for files and directories Overwrites the file myfile.txt and mydir Wildcards … Read more

How to merge a specific commit in Git

‘git cherry-pick‘ should be your answer here. Apply the change introduced by an existing commit. Do not forget to read bdonlan’s answer about the consequence of cherry-picking in this post: “Pull all commits from a branch, push specified commits to another”, where: A—–B——C \ \ D becomes: A—–B——C \ \ D—–C’ The problem with this … Read more

How to rebase local branch onto remote master

First fetch the new master from the upstream repository, then rebase your work branch on that: git fetch origin # Updates origin/master git rebase origin/master # Rebases current branch onto origin/master Update: Please see Paul Draper’s answer for a more concise way to do the same – recent Git versions provide a simpler way to … Read more

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