How do I change the author and committer name/email for multiple commits?

NOTE: This answer changes SHA1s, so take care when using it on a branch that has already been pushed. If you only want to fix the spelling of a name or update an old email, Git lets you do this without rewriting history using .mailmap. See my other answer. Using Rebase First, if you haven’t … Read more

How do I see the differences between two branches?

Use git diff. git diff [<options>] <commit>..​<commit> [–] [<path>…​] <commit> is a branch name, a commit hash, or a shorthand symbolic reference. Examples: git diff abc123..def567, git diff HEAD..origin/master. That will produce the diff between the tips of the two branches. If you’d prefer to find the diff from their common ancestor to test, you … Read more

How do I clone a Git repository into a specific folder?

Option A: git clone git@github.com:whatever folder-name Ergo, for right here use: git clone git@github.com:whatever . Option B: Move the .git folder, too. Note that the .git folder is hidden in most graphical file explorers, so be sure to show hidden files. mv /where/it/is/right/now/* /where/I/want/it/ mv /where/it/is/right/now/.* /where/I/want/it/ The first line grabs all normal files, the … Read more

How do I modify a specific commit?

Use git rebase. For example, to modify commit bbc643cd, run: $ git rebase –interactive ‘bbc643cd^’ Please note the caret ^ at the end of the command, because you need actually to rebase back to the commit before the one you wish to modify. In the default editor, modify pick to edit in the line mentioning … Read more

Git fetch remote branch

Update: Using Git Switch All of the information written below was accurate, but a new command, git switch has been added that simplifies the effort. If daves_branch exists on the remote repository, but not on your local branch, you can simply type: git switch daves_branch Since you do not have the branch locally, this will … Read more

Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)

The problem is that Xcode Command-line Tools needs to be updated. Solution #1 Go back to your terminal and enter: xcode-select –install You’ll then receive the following output: xcode-select: note: install requested for command line developer tools You will then be prompted in a window to update Xcode Command Line tools. (which may take a … Read more

I ran into a merge conflict. How do I abort the merge?

Since your pull was unsuccessful then HEAD (not HEAD^) is the last “valid” commit on your branch: git reset –hard HEAD The other piece you want is to let their changes over-ride your changes. Older versions of git allowed you to use the “theirs” merge strategy: git pull –strategy=theirs remote_branch But this has since been … Read more

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