Skip to content

Instantly share code, notes, and snippets.

@ostanislaw
Last active January 27, 2023 11:34
Show Gist options
  • Save ostanislaw/451eb2d7d8da1f0329e41f59368b1d66 to your computer and use it in GitHub Desktop.
Save ostanislaw/451eb2d7d8da1f0329e41f59368b1d66 to your computer and use it in GitHub Desktop.

Use fish shell + tide, especially for best command history suggestions (https://gist.github.com/ostanislaw/452484846749bfbb7706f2b2b1b71e49#fish-shell)

git fetch 
git branch
git branch -avv

git switch task/master/ADDO-1234-existing-branch

git checkout origin/integ/mater
git switch -C task/master/ADDO-1234-existing-branch

git add --update --patch
(use y/n/s/? - I don't know other options actually)
(and you could break with ctrl+c if you did mistake in your y/n)
(git add is technically performed once for all files after last accepted hunk)

git checkout -

git reflog

git checkout HEAD~2
git checkout HEAD@{2}

git reset [reference]

git reset [--hard] [reference]
git clean -fd

git status -> git merge --abort

General hint: avoid relying on local "copies" of remote master branches like git checkout integ/master, git pull, git checkout -b new_branch And why:

  1. you could forget to do git pull
  2. you could accidentaly commited a change on "integ/master", then git pull and you have conflicts in best case, but worse if it would merge and you would continue with unwanted commit on what you believe is remote integ/master state.
  3. accidental git push from "integ/master" instead try git fetch, git checkout origin/integ/master. The only thing you could forget is git fetch, but it's rather easy to be solved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment