12 Useful Git Commands for Beginners

Introduction:

12 Useful Git Commands for Beginners

Introduction:

Git is a powerful version control system used for tracking changes in a file or directory during any software development process.

The following commands will help you to use git in your next software development project:

  1. git init — to initialize a new git repository.
  2. git add . — adds all the files and folders in the current to the staging area to start tracking changes.
  3. git commit -m ‘a short message’ — creates a snapshot in the .git directory and starts tracking.
  4. git status — to check the status of your files.
  5. git rm <file name> — to remove a file from being tracked.
  6. git clone <remote repository url> — downloads a copy of the remote repository.
  7. git remote add origin <remote repository url> — you add a remote repository to your local repo and push changes to the remote repo.
  8. git checkout -b <new branch name> — creates a new branch and switches to the new branch.
  9. git switch <branch name> — to switch into a different existing branch.
  10. git merge <branch to merge> — to merge changes from a different into the current branch.
  11. git pull — update the local version of a repository from a remote.
  12. git push origin <branch name> — to push local changes to the remote git repository.

Additional commands:

13. git log — to review and read a history of everything that happens to a repository.

14. git help <verb> — to get the comprehensive manual page help for any of the Git commands.

Check out my Website and Subscribe to My Weekly Newsletter:

Narasimman Tech
Find blogs, tips, tutorials, and guides on DevOps, programming languages, cloud APIs, artificial intelligence, machine…

Join My Tech Community:

Narasimman Tech Community
A Community for Software Developers, IT Professionals and Tech Enthusiasts.

Read more