10 Git Commands Every Developer Should Know

10 Git Commands Every Developer Should Know

1. Git clone

git clone <https://name-of-the-repository-link>

2. Git branch

git push -u <remote> <branch-name>

Viewing branches:

git branch or git branch --list

Deleting a branch:

git branch -d <branch-name>

3. Git checkout

git checkout <name-of-your-branch>

There is also a shortcut command that allows you to create and switch to a branch at the same time:

git checkout -b <name-of-your-branch>

4. Git status

git status

5. Git add

To add a single file:

git add <file>

To add everything at once:

git add -A

6. Git commit

git commit -m "commit message"

7. Git push

git push <remote> <branch-name>


git push --set-upstream <remote> <name-of-your-branch>
or

git push -u origin <branch_name>

Important: Git push only uploads changes that are committed.

8. Git pull

git pull <remote>

9. Git revert

git revert 3321844(hash code)

10. Git merge

First you should switch to the dev branch:

git checkout dev

Before merging, you should update your local dev branch:

git fetch

Finally, you can merge your feature branch into dev:

git merge <branch-name>


Comments

Popular posts from this blog

⚡ Online Paste Sites ⚡

Any Video Downloder