Sunday, January 29, 2017

GIT - Commands Reminder

  • git --version
  • git -status
  • git add *file*  - adds files to the repository so that Git knows to track their changes.
  • git commit -m "message"  - commits all added files to the repository as a change. With the -a flag, commits all changes to all tracked files. With the -m flag, allows you to specify a commit message directly on the command line instead of in your default editor.
  • git config - allows you to make configuration changes to Git. With the --global flag, makes these changes available across your entire system.
  • git config --global user.name "Steven"
  • git config --global user.email some@sss.com
  • git log - Show us a chronological log of all of our commits to the current repository.
  • git checkout - "check out" a different version of the code from the one you're currently looking at.
  • git diff - create a "diff" view to demonstrate what has changed between two different versions of your repository.
  • git log --all --decorate --oneline --graph - Decorated commit list.
Commiting

  • git add - adds files to the repository so that Git knows to track their changes.
  • git commit - commits all added files to the repository as a change. With the -a flag, commits all changes to all tracked files. With the -m flag, allows you to specify a commit message directly on the command line instead of in your default editor.
Branching

  • git branch branchname - create a new branch named branchname.
  • git checkout branchname - switch to the branch named branchname.
  • git checkout -b branchname - create a new branch named branchname and switch to that branch.
Cherry-pick

Cherry picking is the act of picking a commit from a branch and applying it to another.

  • git cherrypick ff9a9ab2

Git remove last commit:
git reset --hard Point to next last guid.



No comments:

Post a Comment