• Blogs (9)
    • šŸ“± 236 - 992 - 3846

      šŸ“§ jxjwilliam@gmail.com

    • Version: ā€šŸš€ 1.1.0
  • git checkout remote branch, jshint

    Blogs20142014-12-24


    git checkout remote branch

    I have a new branch `integration` in remote github repository. I want to checkout it clearly. The following list several ways to do so:

    //1. my git version is 1.9.3, I don't have this branch locally:
    git fetch
    git branch -r //locally available now.
    git checkout integration
    
    //2.
    git fetch origin
    git branch -v -a
    //Branch `integration` set up to track remote branch `integration` from origin.
    git checkout -b integration origin/integration
    
    //3.
    git fetch origin
    git checkout integration
    
    //4.
    git fetch && git checkout integration
    
    //5. not try yet:
    git fetch origin 'remote_branch':'local-branch-name'

    Note: `git checkout integration`, it is ā€˜integration’ not ā€˜origin/integration’ to perform magical DWIM-mery and create local branch ā€˜integration’ for you, for which upstream would be remote-tracking branch ā€˜origin/integration’.

    • git checkout
    • git checkout -b

    Same as the above invocation, but base the new branch off of instead of the current branch.

    git stash; git stash list;
    git stash apply
    //or:
    git stash pop
    
    git checkout -f
    //or: --force
    //When switching branches, proceed even if the index or the working tree differs from HEAD. This is used to throw away local changes.
    
    //compare 2 files in 2 different branches.
    git diff mybranch master -- path/myfile.js
    git diff branch1:full/path/to/foo.txt branch2:full/path/to/foo-another.txt
    HashbangMode, HTML5 Mode, Hashbang in HTML5 Mode

    The following is a good explanation: HashbangMode, HTML5 Mode, Hashbang in HTML5 Mode

    .jshintrc

    JSHint Default Configuration File (as on JSHint website)
    See http://jshint.com/docs/ for more details