This shows you the differences between two versions of the page.
| — |
wiki:general:git [2010/01/30 02:24] (current) |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== GIT fast version control useful commands ====== | ||
| + | ===== Creating a remote branch ===== | ||
| + | |||
| + | To create a branch called 'branch_name' | ||
| + | <code bash> | ||
| + | git push origin origin:refs/heads/branch_name | ||
| + | </code> | ||
| + | |||
| + | to check it out (switch to it). | ||
| + | |||
| + | <code bash> | ||
| + | git checkout branch_name | ||
| + | </code> | ||
| + | |||
| + | To see which branch is currently set. | ||
| + | |||
| + | <code bash> | ||
| + | git branch | ||
| + | </code> | ||
| + | |||
| + | ===== Create a local branch ===== | ||
| + | <code bash> | ||
| + | git branch branch_name | ||
| + | </code> | ||
| + | |||
| + | |||
| + | ===== Push a local branch ===== | ||
| + | <code bash> | ||
| + | git push origin local_branch:refs/heads/local_branch | ||
| + | </code> | ||
| + | |||
| + | ===== Delete remote branch ===== | ||
| + | <code bash> | ||
| + | git push origin :heads/branch_name | ||
| + | </code> | ||
| + | |||
| + | |||
| + | ===== Recover deleted files ===== | ||
| + | |||
| + | To list the locally deleted files that exist in the repository | ||
| + | <code bash> | ||
| + | git ls-files -d | ||
| + | </code> | ||
| + | |||
| + | Then to recover them | ||
| + | <code bash> | ||
| + | git ls-files -d | xargs git checkout -- | ||
| + | </code> | ||
| + | |||
| + | ===== Tagging ===== | ||
| + | To list all tags | ||
| + | <code bash> | ||
| + | git tag | ||
| + | </code> | ||
| + | |||
| + | To tag a version, for example 0.1 | ||
| + | |||
| + | <code bash> | ||
| + | git tag -a 0.1 | ||
| + | git push --tags | ||
| + | </code> | ||
| + | |||
| + | ===== Creating ChangeLogs ===== | ||
| + | |||
| + | To create changelog that list changes between two tags | ||
| + | |||
| + | <code bash> | ||
| + | git shortlog --no-merges tag1..tag2 | ||
| + | </code> | ||