-
Clone the Repo:
- git clone <repo_url>
-
Switch to Branch you want:
- git checkout branch_name
-
Stage modified files:
- git add <filename1, filename2>
- to add all files=> git add .
-
Commit the staged files:
- git commit -m "commit msg"
-
check branch: -git branch -git branch -a
-
push the code to remote branch:
- git push
- git push origin remote_branch_name
-
pull the changes from a branch
- git pull origin branch_name
-
Check Remote Git URL:
- git remote -v
-
Set Remote Git:
- git remote add origin
-
Change Remote git URL:
- git remote set-url origin
-
View Changed files:
- git status
-
View how much changes in files:
- git diff --stats
-
View git Logs:
- git log
-
Rollback fro previous commit:
- git checkout <commit_hash>
-
Force push:
- git push -f origin
-
Stash the changes: -git stash
-
Re-Apply the Changes: -git stash pop
-
See What's in Stash:
- git stash list
-
Clear the Stash
- git stash clear
-
Drop a particular stash
- git stash drop stash@{index} # Index will be shown after getting stash list
-
Show Ref
- git show-ref
-
List all Tags
- git tag
-
Create lightweight tag
- git tag tagname
-
Create annotated tag
- git tag -a tagname -m "msg"
-
Push a tag to Remote
- git push origin tagname
-
Pull all local tags to Remote
- git push origin --tags
-
Delete a tag
- git tag -d tagname
Last active
September 7, 2023 09:52
-
-
Save bitwisebro/848f724be7e544c00053fa35aa16a2cc to your computer and use it in GitHub Desktop.
Git Commands for Normies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment