Skip to content
This repository has been archived by the owner on Sep 4, 2019. It is now read-only.

Useful commands

Parker Aldric Mar edited this page Oct 6, 2015 · 3 revisions
  • npm: Installs JS modules. Run with sudo.

    • install -g : e.g. cordova@3.1.0-0.2.0
    • update -g
    • info
  • cordova

    • create <application's display title>: creates applications e.g. cordova create hello com.example.hello HelloWorld
    • platform
      • ls
      • add <platform>
      • rm <platform>
      • update : Need to run if update Cordova framework.
    • build: same as prepare then compile.
      • [<platform>]
    • prepare
      • [<platform>]
    • compile
      • [<platform>]
    • emulate <platform>
    • run <platform>
    • plugin
    • info
    • help
    • <command> --help
    • -v: version
    • requirements <platform>
  • yeoman/yo

    • cordova-plugin-bb10 <project name> <plugin name> <api root>: <plugin name> e.g. cordova-plugin-***
  • git // General commands

    • help [<verb>]

    • config --global credential.helper cache

    • add <file>: multipurpose command

      • –> You use it to begin tracking new files, to stage files, and to do other things like marking merge-conflicted files as resolved. It may be helpful to think of it more as “add this content to the next commit” rather than “add this file to the project”.
      • -> If you modify a file after you run git add, you have to run git add again to stage the latest version of the file. status -s:
      • -> Left-hand column indicates the file is staged
      • -> Right-hand column indicates it is modified.
    • diff: Answers what have you modified but not yet staged?

      • --staged/--cached: Answers what have you staged that will go into the next commit?
    • difftool: diff through external tool

      • --tool-help: what external tools are available
    • commit: edits message with editor with commit

      • -v: includes diff, but can do after commit too.
      • -m <message>: inline message with commit
      • -a: automatically stage every file that is already tracked then commit
      • --amend: amend previous commit with this one (only works if no further modifications)
    • rm

      • <file>: does rm <file>, then you must commit those changes.
      • --cached <file>: untracks file.
    • mv <a> <b>: mv <a> <b> && git rm <a> && git add <b>

    • last: git log -1 HEAD

    • log <options> [-- <path>]

      • -p: shows diff in each commit
      • -<last n entries>
      • --stat: abbreviated stats
      • --pretty=<oneline|short|full|fuller|format:<format>>
      • --since=<e.g. "2008-01-15", "2 weeks">
      • --author=<author>
      • --grep=<grep>
      • --all-match: both instead of either
      • -S <function_name>
    • reset HEAD -- <file> / unstage <file>: unstage a change

    • checkout -- <file>: undo modifications. Be very careful!

    // Working with others

    • remote
      • -v: show remote servers configured from a .git directory
      • --v: see tracking branch info. Need to run git fetch --all beforehand to get latest info for each branch first.
      • add <shortname> <url>
      • fetch <remote-name>: gets all the data from that project which I don't have yet. (Need to merge manually)
      • pull: fetch then merge (better avoid)
      • show <remote-name>
    • push <remote-name> <branch-name>
    • rebase <branch to rebase into>

    // Branches

    • branch: list branches, * on HEAD
      • -v: see last commit on each branch
      • <branch-name>: creates a branch off of this one
      • -d <branch-name>: delete a branch
      • --merged: branches merged into this one.
      • --no-merged
    • checkout
      • <branch>: switch to new branch -b <branch>: create and switch
    • log --oneline --decorate --graph --all: shows where branches are at in the commit graph
    • merge <branch>: first checkout the branch you want to merge into, then merge the other branch in. Open file and resolve conflicts.
    • mergetool <branch>
Clone this wiki locally