An Interest In:
Web News this Week
- April 1, 2024
- March 31, 2024
- March 30, 2024
- March 29, 2024
- March 28, 2024
- March 27, 2024
- March 26, 2024
Git Commands Every Dev MUST know
Hello and Good Morning
I know I had not been writing lately, but now I am back on my writing spree
Today we are going to see some awesome git commands, that every developer MUST know. Look carefully when I stress on the word MUST. Knowing these commands would definitely make your time easier.
So let's start.
- Initialize local git repository
git init
- Add a particular file to a repository
git add git_commands.md
- Add all uncommitted files to the repository
git add .
- Set Repository
git config --global user.name 'mursalfk'
git config --global user.email '[email protected]'
- Add message to your commit
git commit -m "You can add a message to your commit like this"
- See commit history
git log
- Add remote Name/URL
git remote add origin 'https://github.com/mursalfk/mursalfk.git'
- Push your changes to remote repository
git push origin master
- Clone any repository
git clone 'https://github.com/mursalfk/mursalfk.git'
- Update the current working directory
git pull origin master
- Check difference in between commits
git diff HEAD~1 HEAD
- Download files from any repository
git fetch origin master
- Create a new branch
git branch branchName
- Create a new branch inside a folder
git branch branchFolder/branchName
- Switch to another branch
git checkout branchName
- Switch to another branch present in another folder
git checkout branchFolder/branchName
- Create and checkout to the new branch at the same time
git checkout -b branchName
- Create and checkout to the new branch present in another folder at the same time
git checkout branchFolder/branchName
- Merge to a new branch
git merge master
Original Link: https://dev.to/mursalfk/git-commands-every-dev-must-know-53c3
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To