Top 10 Git Commands Every Developer Should Know

By programmingeeksclub.com Match 06, 2023

By programmingeeksclub.com Match 06, 2023

1. Git Init

git init: Initializes an empty Git repository in the current directory

By programmingeeksclub.com Match 06, 2023

2. Git Clone

git clone [url]: Copies an existing Git repository from a remote source (like GitHub) to your local machine.

By programmingeeksclub.com Match 06, 2023

3. Git Add

git add [file]: Adds a file to the staging area for the next commit. You can also use git add . to add all files in the current directory.

By programmingeeksclub.com Match 06, 2023

4. Git Commit

git commit -m "[message]": Commits changes to the repository along with a brief message explaining the changes made.

By programmingeeksclub.com Match 06, 2023

5. Git Status

git status: Shows the status of the working directory and the staging area. This command shows which files have been changed and which files are ready to be committed.

By programmingeeksclub.com Match 06, 2023

6. Git Branch

git branch: Lists all of the branches in the repository. By default, Git creates a branch called "master" when you initialize a repository.

By programmingeeksclub.com Match 06, 2023

7. Git Checkout

git checkout [branch name]: Switches to a different branch. For example, git checkout develop switches to the "develop" branch.

By programmingeeksclub.com Match 06, 2023

8. Git Merge

git merge [branch name]: Merges the specified branch into the current branch. For example, git merge feature-branch merges the "feature-branch" into the current branch.

By programmingeeksclub.com Match 06, 2023

9. Git Pull

git pull: Fetches changes from the remote repository and merges them into the current branch. This command is useful for keeping your local repository up-to-date with changes made by other developers.

By programmingeeksclub.com Match 06, 2023

10. Git Push

git push: Pushes changes to the remote repository. This command is useful for sharing your changes with other developers and keeping the remote repository up-to-date with your local changes.

By programmingeeksclub.com Match 06, 2023