From IT Skills
Jump to: navigation, search

Git is better than SVN

commands[edit | edit source]

  • git status
  • to get data from remote - git fetch [remote-name]

checkout reset[edit | edit source]

  • git checkout

Undoing the changes in the working directory

  • git checkout master
Make sure you are on the lastest commit in the master brach before you continue.
  • git add .

adds everything in folder and subfolders

  • git add modified.file

stages the modified.file

  • git reset

cancel staged

  • git reset --hard origin/master
discard local commits

branching[edit | edit source]

  • git ls-remote

list remote branches

creates new branch foo[edit | edit source]

  • git checkout -b foo

and then updates HEAD to refer to branch foo. In other words, we’ll no longer be in detached HEAD state after this command.

  • git branch foo

but leaves HEAD detached

  • git tag foo

creates a new tag foo leaving HEAD detached