after discussing what is git in the previous article, in this article we are mentioning the most 10 commands you need to get started with GIT
git init:
Initializes a new Git repositry in the current directory
git clone [repository_url]:
Clones an existing Git repository from the specfied URL to your local machine
git add [file(s)]:
Stages changes for commit. Use git add . to stage all changes in the current directory.
git commit -m "commit message":
Commits the staged changes along with a descriptive commit message.
git pull:
Fetches changes from a remote repository and merges them into the current branch.
git push:
Pushes your local commits to the remote repository.
git branch:
Lists all branches in your repository. Use -r to see remote branches and -a to see all branches.
git checkout [branch_name]
Switches to the specified branch. You can also use this command to create a new branch.
git merge [branch_name]
Merges changes from the specified branch into the current branch.
git log:
Shows a log of all commits in the current branch, including commit hashes, authors, dates, and commit messages. Use --graph for a visual representation of branching.
These commands provide the basic functionality needed to work with Git effectively.
Depending on your workflow and project requirements, you may need to use additional Git commands and options for more advanced tasks.
Top comments (2)
also
git diff
is very important command especially when you need to examine your branch to find out differencesyes this is true