1.git init
Initializes a new, empty Git repository in your current directory. creates a hidden .git folder. This folder is the brain of your repository, storing all your tracking data, history, and branches.
git init
2.git clone
Creates a local copy of an existing remote repository.Instead of starting from scratch, git clone downloads all the files, branches, and commit history from a remote server to your local machine.
git clone <repository_url>
3.git status
Displays the state of your working directory.It won't change any files; it just tells you what is going on
git status
4.git add
Adds modified or new files.You have to tell it exactly what you want to include in your next save. The staging area is like a loading dock. git add moves files.
add a specific file:
git add <file_name>
add all changed files in the current directory:
git add .
5.git commit
It acts as a permanent save point, capturing the state of files at a specific moment in time.
git commit -m "message here"
6.git switch
Switches your working directory to a different branch.Once you create a branch, you have to move into it to start working.
git switch <branch_name>
7.git merge
Combines the history of one branch into another.
git merge <branch_to_merge_in>
8.git push
Uploads your local commits to a remote repository.Your local commits only exist on your computer. git push sends your saved milestones to the remote server (like GitLab and GitHub) so others can see and download your work.
git push origin <branch_name>
9.git pull
Fetches and downloads content from a remote repository and immediately updates the local repository.
git pull origin <branch_name>
Top comments (0)