Skip to content

Instantly share code, notes, and snippets.

@michal-lipski
Last active June 28, 2017 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michal-lipski/0d739b17835c3029f78cb33376751b06 to your computer and use it in GitHub Desktop.
Save michal-lipski/0d739b17835c3029f78cb33376751b06 to your computer and use it in GitHub Desktop.

getting Git

https://help.github.com/articles/set-up-git

configuring Git

must have config:

git config --global user.name "my name" ?
git config --global push.default upstream ? ?

additional config

Checkout this blog http://devyard.wordpress.com/2012/09/04/best-git-tools-configuration-tips/
Sample configs: https://github.com/jakubnabrdalik/gitkurwa/blob/master/config

working on new feature

git add <you_files> ?
git commit -m "my change"
git push

starting new feature

git checkout master ?
git checkout -b feature_name ?
git push -u origin feature_name ? ?

merging feature

first merge master to your feature branch

git pull
git merge --no-ff remotes/origin/master ?

if you have some conflicts:

  • resolve them in you favorite merging tool
  • git add . add files after merge
  • git commit -m "merge message" commit merge

git push

then merge you feature to master

git checkout master
git merge --no-ff remotes/origin/feature_name
git push

Git fuckups

my last commit was a mistake i want to revert it and i didn't pushed it yet

git reset --soft HEAD^

my last commit was a mistake and i pushed it, now i want to revert it

git log --oneline show commit hash
git revert ab51bc32 revert commit with given hash ?
git push push reverting commit

i messed up and i want to have clean repository i don't care for any of my changes

git reset --hard HEAD !

More Resources

Here are some other things that you can read about git:

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