How can I selectively merge or pick changes from another branch in Git?

I had the exact same problem as mentioned by you above. But I found this clearer in explaining the answer. Summary: Check out the path(s) from the branch you want to merge, $ git checkout source_branch — <paths>… Hint: It also works without `–` like seen in the linked post. or to selectively merge hunks … Read more

How do I configure git to ignore some files locally?

From the relevant Git documentation: Patterns which are specific to a particular repository but which do not need to be shared with other related repositories (e.g., auxiliary files that live inside the repository but are specific to one user’s workflow) should go into the $GIT_DIR/info/exclude file. The .git/info/exclude file has the same format as any … Read more

.gitignore is ignored by Git

Even if you haven’t tracked the files so far, Git seems to be able to “know” about them even after you add them to .gitignore. WARNING: First commit or stash your current changes, or you will lose them. Then run the following commands from the top folder of your Git repository: git rm -r –cached … Read more

Git diff against a stash

See the most recent stash: git stash show -p See an arbitrary stash: git stash show -p stash@{1} From the git stash manpages: By default, the command shows the diffstat, but it will accept any format known to git diff (e.g., git stash show -p stash@{1} to view the second most recent stash in patch … Read more

How can I reconcile detached HEAD with master/origin?

First, let’s clarify what HEAD is and what it means when it is detached. HEAD is the symbolic name for the currently checked out commit. When HEAD is not detached (the “normal”1 situation: you have a branch checked out), HEAD actually points to a branch’s “ref” and the branch points to the commit. HEAD is … Read more

How do I undo ‘git reset’?

Short answer: git reset ‘HEAD@{1}’ Long answer: Git keeps a log of all ref updates (e.g., checkout, reset, commit, merge). You can view it by typing: git reflog Somewhere in this list is the commit that you lost. Let’s say you just typed git reset HEAD~ and want to undo it. My reflog looks like … Read more

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