Basic git commands
git init
: Initializes a brand new Git repository and begins tracking an existing directory. It adds a hidden subfolder within the existing directory that houses the internal data structure required for version control.
git clone
: Creates a local copy of a project that already exists remotely. The clone includes all the project’s files, history, and branches.
git add
: Snapshots the file in preparation for versioning, adding it to the staging area.
git commit:
Records file snapshots permanently in the version history.
git status:
Shows the status of changes as untracked, modified, or staged.
git branch:
Shows the branches being worked on locally.
git checkout:
Switches to the specified branch and updates the working directory.
git merge
: Merges lines of development together. This command is typically used to combine changes made on two distinct branches.
git pull
: Updates the local line of development with updates from its remote counterpart. Developers use this command if a teammate has made commits to a branch on a remote, and they would like to reflect those changes in their local environment.
git push
: Updates the remote repository with any commits made locally to a branch.
git remote -v
:Show the associated remote repositories and their stored name.
git tag
: Tag specific points in a repository’s history.