Pragmatic Version Control Using Git (note)

Source: Internet
Author: User
Tags sha1 hash using git

Pragmatic Version Control Using GitJump to: Navigation, search
  1. git config--global user.name "Travis Swicegood"
  2. git config--global user.email "[Email protected]"
  3. git config--global--list
  4. git config--global color.ui "Auto"
  5. CD MySite && git init
  6. Git commit-m "Add in Hello World HTML"//SHA1 Hash
  7. Git branch rb_1.0 master//Create Branch
  8. git checkout rb_1.0//?? Doesn't seem to go to another directory?? I personally doubt the efficiency of doing this (however, maybe Linux ext3 file links are easier to handle?). )
  9. Git tag 1.0 rb_1.0//tag: Mark a special point in time ...
  10. Rebase: Merging changes on the branch to the mainline
    1. git checkout Master
    2. git rebase rb_1.0//Try to replay all changes ...
    3. git branch-d rb_1.0//once merged into the main line, you can remove the branch
    4. However, how do I recover from a branch after it has been deleted? Available from Tag:git Branch rb_1.0.1 1.0 This is just to fix a specific state of the patch released
  11. git log--pretty=oneline
  12. Git Archive--format=tar--prefix=mysite-1.0/1.0 | gzip > mysite-1.0.tar.gz
  13. git clone git://github.com/tswicegood/mysite.git mysite-remote//Remote Repository
  14. Git add-i//interactive mode?
  15. git add-p//export patch file (this is like, other svn, Hg have not seen so convenient)
  16. Show difference (1) What's in the Your working tree, (2) What's staged and ready to being committed, and (3) What's in your Repository:git diff |--cached| HEAD
  17. Add. *.swp to the. Gitignore ...
  18. Branching rename: Git branch-m old New
  19. One of the hardest parts of branches is figuring in to create a branch. It's an art, isn't a science
    1. Experimental changes
    2. New Features
    3. BUG fixes
  20. Checkout-b (Create new branch while checkout)
  21. Merging: (Note that you will need to submit after merge!) )
    1. Straight Merge: Merge 2 branches: Execute git Merge branch on the main line
    2. Squashed commits: Compress multiple commits on a branch, converting to a single commit on another (? ), git merge--squash branch
    3. Cherry-picking: Send a commit on one branch directly to another branch (this is cool, mecurial doesn't support ~ ~) git Cherry-pick 321d76f (the commit number on the branch)
      1. -N option: to does the merge but stop before creating a commit
  22. git reset--hard head^
  23. View history: Git log (can append additional parameters specified range, slightly)
  24. Track changes in a specific file: Git blame-l 12,13 hello.html//Note: can 12,+2 or 13,-2 description (Micro syntax ~ ~)
  25. revert: Rewriting history ... Break one commits into multiple commits??
  26. git fetch: Keep up-to-date with remote repositories
  27. Git branch-r
  28. git push
  29. git diff: See the changes between the 2 versions (shown as a differential commit, this feature MERCURIAL/HG is not available, SVN can make comparisons), and git log will show the history of all commits
  30. Beyond the Basics (slightly):
    1. Git gc:compacting your repository history
    2. Git archive:exporting your repository
    3. git rebase:rebasing a branch ' s history against its parent
    4. Using the Reflog to fix your repository
    5. Bisecting your repository to find the change introduced a bug

Pragmatic Version Control Using Git (note)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.