clone:
This command is used in the Git version control system to create a copy of a repository, including all of its files, branches, and commit history, on your local machine. This allows you to work on the codebase, make changes, and contribute to the project without affecting the original repository. Here is the repository I'll be cloning:
There are two ways to use the clone command:
git clone [repository-url]
:
By this command the repository will be cloned in the present working directory.
git clone [repository-url] [directory-where-to-save-the-repository]
By this command all the files in the repository will be saved into the specified directory.
status:
This command is used to list new or modified files. This command is written as git status
add:
This command is used to stage the files. There are two ways to use this command.
git add .
: This command stage all the change files.git add [file]
: This command stage the specific file.
commit:
There are various options with the commit command.
git commit
: This command commit previously staged changes.git commit -a
: This command commit all the local changings in the tracked files.git commit -amend
: This command change the last commit.
log:
This command is used to show full change history. This command is written as git log
.
push:
This command is used to push the committed changes to a remote repository. This command is written as git push [remote-repo-url] [branch]
.
pull:
This command is used to retrieve updates from a remote repository and integrate them into your local branch automatically. This command is written as git pull [repo-url] [branch]
.
fetch:
This command is used to retrieve updates from a remote repository without merging them into your local branches immediately. This command is written as git fetch [reposistory-url]
.