Skip to content

Instantly share code, notes, and snippets.

@zoeabryant
Last active September 26, 2017 10:45
Show Gist options
  • Save zoeabryant/8d52fc4fa262916b256cf96ec453290e to your computer and use it in GitHub Desktop.
Save zoeabryant/8d52fc4fa262916b256cf96ec453290e to your computer and use it in GitHub Desktop.

🐚

cmd (left arrow )

  • go back in slack history

history | grep hello

  • search terminal history for 'hello'

git branch -d $(git branch --merged)

  • removes branches that have been merged.

git remote prune origin

  • will prune tracking branches not on the remote.

git checkout HEAD ~1 -- app/actions

  • restore folder deleted 2 commits ago

git add -u

  • add unstaged changes

git commit --amend --no-edit

  • append to last commit without editing the message

git diff --name-only --diff-filter=U

  • show the files that are unmerged only

git diff --name-only --diff-filter=U

  • list only git commit

net stat -na | grep 8080

  • see what is using port 8080

ifconfig | grep inet

  • get ip quickest

git stash --keep-index

  • This will stash everything that you haven’t previously added. Just git add the things you want to keep, then run it.

rebasing

git checkout master

git pull --rebase

git checkout -

git rebase master

  • after fixing conflicts:

  • git rebase --continue

fuck this branch, go to master

git clean -n

git clean -n -fd(go for it)

git checkout master

git branch -d (branch)

undo your stupid rebase

git reflog

  • to view a log of all the git commands you have run

  • allll your dirty git commands right there

git reset --hard HEAD@{8}

  • copy HEAD@{8} from whatever you want

git push -f

  • ❤️scary force push

so you merged off the wrong branch and now you need to only have your changes

git merge-base my-branch master

  • prints the commit when my-branch diverged from master

grbi <commit>

  • interactive rebase to that commit
  • in the interactive file, dd to drop commits that weren't yours

git push -f

  • to update remote

osx stuff

ctrl a

  • start of line

ctrl e

  • end of line

ctrl u

  • delete line

ctrl l

  • clear screen

cmd space

  • search computer

ruby -run -e httpd . -p 8888

  • simple ruby server

there's a few things that could be; rather than take up your time now, I'd like to do some research on my own and confirm the best route to take. Does that work for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment