Skip to content

Latest commit

 

History

History
41 lines (33 loc) · 1.71 KB

1.3-git.md

File metadata and controls

41 lines (33 loc) · 1.71 KB

git

Git is a version control tool used by Drupal.

It is recommended you learn git separately, but here are some commonly used commands:

Basic git commands

  • git add - Adds files to staging area.
  • git commit - Commits files to repo.
    • -a: Adds all unstaged files.
    • -m: Sets commit message from command line.
    • --amend: Amends the most recent commit message.
  • git push - Pushes local repo to a remote repo.
  • git pull - Incorporates changes from a remote repository into the current branch.
  • git clone - Clones a remote repo to your local system.
  • git checkout - Switch to another branch
    • -b: Create a new branch prior to switching
  • git rebase - Changes the history of a commit relative to another commit.
  • git merge - Merges one branch into another.
  • git reset - Resets HEAD to specified state.
  • git clean - Removes unstaged files from working tree.
  • git revert - Reverts changes made in a commit.
  • git log - Show commit logs.

Advanced git commands

  • git cherry-pick - Applies changes introduced by another commit (useful across branches).
  • git bisect - Finds commit that introduced bug/functionality change using binary search which is O(lg n).
  • git grep - Find lines/files matching pattern within repo.
  • git reflog - Manage reflog information.
  • git gc - Performs garbage collection on local repository.

Additional Resources