12 Useful git commands for Beginners
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:
- git init - to initialize a new git repository.
- git add . - adds all the files and folders in the current to the staging area to start tracking changes.
- git commit -m ‘a short message’ - creates a snapshot in the .git directory and starts tracking.
- git status - to check the status of your files.
- git rm <file name> - to remove a file from being tracked.
- git clone <remote repository url> - downloads a copy of the remote repository.
- git remote add origin <remote repository url> - you add a remote repository to your local repo and push changes to the remote repo.
- git checkout -b <new branch name> - creates a new branch and switches to the new branch.
- git switch <branch name> - to switch into a different existing branch.
- git merge <branch to merge> - to merge changes from a different into the current branch.
- git pull - update the local version of a repository from a remote.
- git push origin <branch name> - to push local changes to the remote git repository.
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.
To know more about git, please check out https://git-scm.com/