How to see commits that were merged in to a merge commit?

git log abc123^..abc123 shows the commits that got merged into merge-commit abc123. Create a git alias log-merge for easy reuse: $ git config –global alias.log-merge \ ‘!f() { git log –stat “$1^..$1”; }; f’ $ git log-merge abc123 For a one-line version: $ git config –global alias.log-merge-short \ ‘!f() { git log –pretty=oneline “$1^..$1”; }; … Read more

Please enter a commit message to explain why this merge is necessary, especially if it merges an updated upstream into a topic branch

The commit message is from Git, but it is actually the editor that keeps you from quitting. This is because Git uses your default editor, which for a variety of reasons is usually set to vi (it might be something else on your OS, like pico). To write a commit message and get out of … Read more

Commit only part of a file’s changes in Git

You can use: git add –patch <filename> or for short: git add -p <filename> Git will break down your file into what it thinks are sensible “hunks” (portions of the file). It will then prompt you with this question: Stage this hunk [y,n,q,a,d,/,j,J,g,s,e,?]? Here is a description of each option: y stage this hunk for … Read more

What is a dangling commit and a blob in a Git repository and where do they come from?

During the course of working with your Git repository, you may end up backing out of operations, and making other moves that cause intermediary blobs, and even some things that Git does for you to help avoid loss of information. Eventually (conditionally, according to the git gc man page) it will perform garbage collection and … Read more