GIT Essential Tasks

0
102

Here are some of the most popular and frequently used Git commands, along with brief descriptions of their functions:

  1. git init:
  • Initializes a new Git repository in the current directory.
  1. git clone [url]:
  • Creates a copy of an existing remote repository.
  1. git add [file]:
  • Adds a file to the staging area.
  1. git commit -m "[message]":
  • Records changes to the repository with a descriptive message.
  1. git status:
  • Shows the status of changes as untracked, modified, or staged.
  1. git log:
  • Displays the commit history.
  1. git push [remote] [branch]:
  • Uploads local branch commits to the remote repository.
  1. git pull [remote] [branch]:
  • Fetches and merges changes from the remote repository to the current branch.
  1. git branch:
  • Lists all local branches in the repository.
  1. git checkout [branch]:
    • Switches to another branch and updates the working directory.
  2. git merge [branch]:
    • Merges a specified branch into the current branch.
  3. git remote:
    • Manages set of tracked repositories.
  4. git fetch [remote]:
    • Downloads objects and refs from another repository.
  5. git rebase [branch]:
    • Reapplies commits on top of another base tip.
  6. git reset [file]:
    • Unstages a file while retaining the changes in the working directory.
  7. git diff:
    • Shows the differences between changes in the working directory and the staging area.
  8. git rm [file]:
    • Removes files from the working directory and stages the removal for commit.
  9. git stash:
    • Temporarily saves changes that are not ready to be committed.
  10. git tag [name]:
    • Tags a specific commit for easier reference.
  11. git config:
    • Sets configuration values for your user name, email, and other preferences in Git.

These commands form the basic toolkit for working with Git and cover most of the essential tasks for version control and collaboration.