Download git-bash by clicking here.
You have to set username and email in git, because every commit use this information
git config --global user.name "Nishant Patel"
git config --global user.email mpatel@example.com
If you don't want to use default editor and what to use atom for that, you can write following to set editor
git config --global core.editor atom
git init
git status
git log
git log --oneline
git diff
git add .
git reset HEAD -- .
git commit -m "commit_message"
git checkout -b new_branch_name
git branch
git log --graph --decorate --oneline --all
OR
git log --graph --simplify-by-decoration --oneline --all
git remote add origin "https://github.com/nishantkp/git-basics"(your-remote-repository)
git remote add upstream "https://github.com/cvbutani/git-basics"(pull-remote-repository)
git remote rm origin
git remote -v
or git remote
git push origin master
origin -> remote repository name
master -> local repository branch
git pull origin master or git fetch origin master
origin -> remote repository name
master -> local repository branch
Dont forget to merge after using git fetch
Secenario : You were working on a certain branch of a git repository, and you committed some changes to it. Then you realize, this particular commit should also go to another branch of the repository BUT you are not ready for a complete merge. Maybe this commit was meant for the other branch?
git cherry-pick <commit-hash>
git branch -m new-name
git branch -m old-branch new-branch
git branch -d local-branch
git push origin --delete remote-branch