chufnagel / productivity-hacks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

productivity-hacks

Resources

SSH Keys

Tired of typing in your password constantly when pushing to Git? Start using SSH keys!

https://github.com/settings/keys

  1. To generate an ssh-key on OSX, open Terminal and write: ssh-keygen -t rsa -b 4096 -C "*your_email@example.com*"

  2. You’ll be asked to give it a name and a password

    • The default name is id_rsa - stick with this for now

    • id_rsa and id_rsa.pub will be saved to <your home folder>/.ssh

    • the . means the folder is invisible! You can list invisible files in terminal by writing ls -a

    • id_rsa is your private key! Keep it secret!

  3. Type pbcopy < ~/.ssh/id_rsa.pub to copy your public key to your clipboard

  4. Go to https://github.com/settings/keys and choose New SSH key

  5. Give it a name, then press Command + V to paste your public key

  6. In Terminal, type ssh-add -k ~/.ssh/id_rsa and type in your password

    • You’ll need to do this every time you open Terminal (for now)

Now you can clone git repos using your SSH key!

# Instead of writing

git clone https://github.com/chufnagel/productivity-hacks.git

# You can write:

git clone git@github.com:chufnagel/productivity-hacks.git

# To change a repo to use SSH instead of HTTPS, you’ll need to run:

git remote set-url origin git@github.com:*USERNAME*/*REPOSITORY*.git

# To change a repo from using SSH to HTTPS, just write:

git remote set-url origin https://github.com/*USERNAME*/*REPOSITORY*.git

More info here: https://help.github.com/articles/changing-a-remote-s-url/

Check out the fix_github_https_repo.sh (also included in the repository)

Aliases

Tired of writing out git commands? Make an alias!

  1. In Terminal, type in cd to navigate to your home directory

  2. Write touch .bash_profile to create a bash profile

  3. Open up .bash_profile with your text editor of choice

  4. Add your aliases!

  5. Reload Terminal to activate them. You can see your current aliases by typing in alias

Aliases are awesome, but you should still know how git works and how to do these things on your own!

Example aliases:

alias gcd="git checkout dev”

alias gcm="git checkout master”

alias gcb="git checkout -b”

alias gcmsg="git commit -m”

alias glud="git pull origin dev”

alias gpod="git push origin dev”

alias gpom="git push origin master”

alias gf="git fetch”

alias gfo="git fetch origin”

alias grbi="git rebase -i”

alias gcp="git cherry-pick”

Other nice git stuff:

Temporarily store all your uncommitted git changes:

git stash

Then bring them back (don’t wait too long):

git stash pop

See what will happen in a merge without commiting anything:

git merge --no-commit --no-ff branch-to-merge

GitKraken has a lovely interface and makes it much easier to visualize your commit history and perform some of the trickier git operations.

While GitKraken is incredibly nice, you should still know how to use git

VS Code

  • Settings Sync - Move between computers and operating systems frequently? Take your configuration with you!

  • VS Live Share - Pair programming? Use this to launch a collaborative session!

  • VS Code Icons - Make it easier to navigate your project directory!

  • Power Mode - the most important extension of all

About


Languages

Language:Shell 100.0%