Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

$ git checkout BRANCH_NAME

Synopsis: 

git checkout [-q] [-f] [-m] [<branch>] 

git checkout [-q] [-f] [-m] --detach [<branch>]

git checkout [-q] [-f] [-m] [--detach] <commit>

git checkout [-q] [-f] [-m] [[-b|-B|--orphan] <new_branch>] [<start_point>]

git checkout [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <pathspec>…​

git checkout [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] --pathspec-from-file=<file> [--pathspec-file-nul]

git checkout (-p|--patch) [<tree-ish>] [--] [<pathspec>…​]

Options:

  • -q , --quiet : Quiet, suppress feedback messages.
  • --progress : Progress status is reported on the standard error stream by default when it is attached to a terminal, unless --quiet is specified.
  • -f , --force :When switching branches, proceed even if the index or the working tree differs from HEAD. This is used to throw away local changes.
  • -b <new_branch> : Create a new branch named <new_branch> and start it at <start_point>
  • -B <new_branch> : Creates the branch <new_branch> and start it at <start_point>; if it already exists, then reset it to <start_point>. This is equivalent to running "git branch" with "-f".
  • -t , --track  : When creating a new branch, set up "upstream" configuration.
  • --no-track : Do not set up "upstream" configuration, even if the branch.autoSetupMerge configuration variable is true.

Example

checks out the master branch.

$ git checkout master

add

To stage changes[file modifications and deletions].Accepts arguments for files or directories within the project directory. 

$ git add

Synopsis: 

git add [--verbose | -v]      [--dry-run | -n]    [--force | -f]    [--interactive | -i]     [--patch | -p]     [--edit | -e]     [--[no-]all | --[no-]ignore-removal | [--update | -u]]    [--intent-to-add | -N]   [--refresh] 

             [--ignore-errors]  [--ignore-missing]     [–renormalize]        [--chmod=(+|-)x]    [--pathspec-from-file=<file> [--pathspec-file-nul]]         [--] [<pathspec>…​]

Options:

$ git add [options]

...

Consists of a snapshot of the directory structure and file contents for the entire project.Record changes to the repository.

$ git commit

Synopsis: 

git commit [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [–amend]

[--dry-run] [(-c | -C | --fixup | --squash) <commit>]

[-F <file> | -m <msg>] [--reset-author] [--allow-empty]

[--allow-empty-message] [--no-verify] [-e] [–author=]

[--date=<date>] [--cleanup=<mode>] [--[no-]status]

[-i | -o] [--pathspec-from-file=<file> [--pathspec-file-nul]]

[-S[<keyid>]] [--] [<pathspec>…​]

Options:

  • -a , --all : Tell the command to automatically stage files that have been modified and deleted, but new files you have not told Git about are not affected.
  • --p , --patch : Use the interactive patch selection interface to chose which changes to commit.
  • -C <commit> ,  --reuse-message=<commit> : Take an existing commit object, and reuse the log message and the authorship information (including the timestamp) when creating the commit.
  • -c <commit> , --reedit-message=<commit> : Like -C, but with -c the editor is invoked, so that the user can further edit the commit message.
  • --squash=<commit> : Construct a commit message for use with rebase --autosquash
  • --branch : Show the branch and tracking info even in short-format.
  • -F <file> , --file=<file> : Take the commit message from the given file. Use - to read the message from the standard input.

...