Skip to content

Instantly share code, notes, and snippets.

@rahularity
rahularity / work-with-multiple-github-accounts.md
Last active April 20, 2025 10:54
How To Work With Multiple Github Accounts on your PC

How To Work With Multiple Github Accounts on a single Machine

Let suppose I have two github accounts, https://github.com/rahul-office and https://github.com/rahul-personal. Now i want to setup my mac to easily talk to both the github accounts.

NOTE: This logic can be extended to more than two accounts also. :)

The setup can be done in 5 easy steps:

Steps:

  • Step 1 : Create SSH keys for all accounts
  • Step 2 : Add SSH keys to SSH Agent
@rambabusaravanan
rambabusaravanan / .gitconfig
Last active March 4, 2025 16:34
Git Diff and Merge Tool - IntelliJ IDEA
# Linux
# add the following to "~/.gitconfig" file
[merge]
tool = intellij
[mergetool "intellij"]
cmd = /usr/local/bin/idea merge $(cd $(dirname "$LOCAL") && pwd)/$(basename "$LOCAL") $(cd $(dirname "$REMOTE") && pwd)/$(basename "$REMOTE") $(cd $(dirname "$BASE") && pwd)/$(basename "$BASE") $(cd $(dirname "$MERGED") && pwd)/$(basename "$MERGED")
trustExitCode = true
[diff]
@esperancaJS
esperancaJS / gist:e09260d73dfe242859dc
Last active March 10, 2023 18:22
git merge –strategy=theirs (closest we can get)

##git merge –strategy=theirs (closest we can get)

get a temp copy of the branch you want to 'clone' into another

git checkout -b tmp <branch to copy from>

merge our version of the branch into the upstream with ours strategy

git merge --strategy=ours