Thursday, March 12, 2015

Git basic

  1. Do work on a web site.
  2. Create a branch for a new story (iss53) you’re working on.
    git checkout -b iss53
  3. Do some work in that branch.
    git commit -a -m 'added a new footer [issue 53 comment]'
    
    
At this stage, you’ll receive a call that another issue is critical and you need a hotfix. You’ll do the following:

  1. Switch to your production branch. 
    git checkout master 
    
  2. Create a branch to add the hotfix. 
  3. git checkout -b hotfix
  4. After it’s tested, merge the hotfix branch, and push to production.
    git commit -a -m 'fixed the broken email address'
  5. $ git checkout master ( 要先切回目的地)
    $ git merge hotfix
    
  6. Switch back to your original story and continue working.
git checkout master
git merge iss53
Merge Conflict:
git status
衝突的檔案會留著,檔案內衝突的部分用====分野
Reference link.

Git svn
git log 查hash code
git branch branch_name hash_code
git checkout hash_code
git checkout -b $branch_name $hash_code

git stash
git checkout -b new_branch
git stash pop
git list-files

No comments:

Post a Comment