Every developer should be familiar with this Git commands.
Okay, Git is necessary to keep our project in a safe place. we can also collaborate on a specific project & build something grate things. So that's why a git is a necessary tool for every developer. Today I will show you some useful git commends which will use every moment.
1. Initializes a new Git repository
git2. Add file or add all files
git add file_name
//or
git add .3. Reverts to the last commit & undoes the changes to the local files.
git reset4. The difference between two commits' files, or between a commit and your current repository, is displayed.
git diff5. It's used to see how the staging area and working directory are doing.
git status6. This command is used to commit files to the repository (locally).
git commit -m "message"7. See the commit history
git log8. This command is used to display a list of all the machine's local branches.
git branch9. Download existing code from a remote repository.
git clone10. To establish a new branch locally, use this command.
git branch branch_name11. Delete a branch.
git branch -d branch_name12. To rename current working branch, used to this command
git branch -m new_branch_name13. The provided branch is merged into the current functioning branch.
git merge branch_name14. Switch current branch to another branch.
git checkout branch_name15. Creating a new branch & switch to the new one.
git checkout -b branch_name16. Save all commits to the remote repository.
git push <remote> <branch>
//example
git push main branch_name
//check your all remote repository
git remote -v17. Pull down all the updates rom the remote repository.
git pull remote_name
//example
git pull main18. Remove a file from the working directory.
git rm file_name19. It's used to get rid of changes that haven't been committed yet.
git stash20. Removing Git from a project
If you want to completely remove Git from a project, simply open it, make sure you can see hidden files, then delete the '.git' folder.