20 March 2014

Git notes

WARNING!
This is personal notes for personal and my friends only:
http://dominiksymonowicz.blogspot.co.uk/2014/01/itnotes-information.html
You can read them,but I suggest look to link,resources only


Git is a distributed revision control and source code management tool.

Book:


  1. Pro Git (book is free,but if you use ,please buy it)

Articles:

Useful command and command combos:
  • Change name of current branch:
    • git branch -m newname 
    • where newname is name of the branch
  • Unmodify modified file
    • git checkout -- pathToFile
    • where pathToFile is a file (path to file,that should be deleted (git status display all modified file  or actually path to them,just copy it and use as  pathToFile  )
  • How change message from last commit in Git?
  • -force-with-lease
    • use -force-with-lease instead -force-force-with-lease effectively only allows you to force-push if no-one else has pushed changes up to the remote in the interim.
  • How to remove all untracked files
    • git clean -df
  • Nice shortcut for quick commit , where you add all files and commit them with message.
    • git commit -a - m "Describe your job or title from Jira "
  • How to cancel and undo merge ,if you have conflict problems  
    • git merge --abort
  • Delete all uncommitted changes  
    • git checkout -- .
  • How to recover from shit happens like lost commit ? Use Reflog which is shortcut for Reference logs.
    • git reflog

Sources:
https://git-scm.com/docs/git-clean
https://git-scm.com/docs/git-reflog