Git Commands

Here are some of the most common Git commands:
  • init: Creates a new Git repository.
  • clone: Clones an existing Git repository to your local machine.
  • add: Adds changes to the index.
  • commit: Creates a new commit with the changes in the index.
  • push: Pushes changes from your local repository to a remote repository.
  • pull: Pulls changes from a remote repository to your local repository.
  • status: Shows the status of your working tree.
  • log: Shows the history of commits in your repository.
  • branch: Creates or switches to a branch.
  • merge: Merges changes from one branch into another.
  • checkout: Switches to a branch or file.
  • reset: Resets the working tree to a previous state.
  • rm: Removes a file from the working tree or index.
  • stash: Saves changes to the index or working tree so that they can be restored later.
  • diff: Shows the differences between two states of the repository.
  • rebase: Rebases one branch onto another.
  • tag: Creates a tag to mark a specific point in the history of the repository.
  • verify: Verifies the authenticity of a Git object.
  • fsck: Checks the filesystem for inconsistencies.
  • gc: Optimizes the repository for performance.
These are just a few of the many Git commands that are available. For more information, please consult the Git documentation. Here are some additional tips for using Git commands:
  • Use the -v flag to get more verbose output from Git commands.
  • Use the -h flag to get help for a specific Git command.
  • Use the -n flag to dry run a Git command without making any changes.
  • Use the -q flag to run a Git command quietly.
  • Use the -e flag to specify an alternate editor for Git commands that require editing.
ADVERTISEMENT
ADVERTISEMENT