Learn Git using Git Repository

A simple ways to understand Git Basic Commands

Why using version control ?

  1. collaborate !
  2. a better professional
  3. allow you to revert back
  4. compare changes
  5. easy recover and track

Git Basic

main target : understand basic git command

  • git init
  • git config --global user.name "yunanhelmy"
  • git config --global user.email "yunan@softwareseni.com"
  • git remote add origin git@github.com:yunanhelmy/learn-git.git
  • git remote remove origin
  • git status
  • git add -A
  • git commit -m "this is my comment"
  • git push origin master
  • git pull origin master
  • git diff HEAD
  • git checkout index.html
  • git stash
  • git reset HEAD~1
  • git revert HEAD~1

git blame

i can see every your move !

more at learn git repository


  • separate your short-lived branch and long-lived branch
  • use short-lived branch for every issue you had
  • periodically delete your short-lived branch
  • don't push your short-lived branch to the remote repository, unless you want to share the code to other developers
  • name your long-lived branch clearly and understandable, eg production, staging, live, development
  • name your short-lived branch with prefix (if you don't have issue number / ticket number). this will make you easy to remember when you have a lot of short-lived branch
  • create another master backup if you are unsure when you want to merge. test it in that backup before going to master. don't forget to delete your junk branch
  • use revert instead reset unless you want completely remove commit history
  • be aware with rebase. one failure can be a fatal. rebasing will completely override code. that means you lost the changes in the same file





Thats it the basic you need to know

Check for details https://github.com/yunanhelmy/learn-git