How to use git ??? (Continious Updating)

  1. Create new Branch

    git checkout -b [ default to master]</code>

    Git commit -m ""

    Git push --set-upstream </code>

  2. Clone specific branch from remote repository

    git clone -b my-branch repository_url

    With Git 1.7.10 and later, add –single-branch to prevent fetching of all branches. Example, with OpenCV 2.4 branch:

    git clone -b opencv-2.4 --single-branch </code>

  3. Restore a deleted local repository file

    • Get revision number

    git rev-list -n 1 HEAD -- </code>

    • Restore to the above revision number

    git checkout -- </code>

  4. Delete a local branch

git branch -d branch_name

  1. Force pull remote and overwrite local branch

git fetch --all git reset --hard origin/branch_name

  1. discard local change by overwrite with local repository git checkout -- </code>

  2. Force pull remote and overwrite local file

git fetch git checkout origin/master </code>