Versions Compared

Key

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

...

  • -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.

...

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 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>…​]

...

  • -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.

Example:

$ edit hello.c
$ rm goodbye.c
$ git commit -a
The command git commit -a first looks at your working tree, notices that you have modified hello.c and removed goodbye.c, and performs necessary git add and git rm for you.

branch

To view a list of existing branches

...

Creates a new topic branch

$ git branch [branch]

Synopsis: 


merge

Merges [branch] into current branch.

...