Last active
October 2, 2024 00:00
-
-
Save dvsbharadva/299cbc634c4d0d9da5cd32f4f9864df8 to your computer and use it in GitHub Desktop.
Try this useful common git commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
⌨ Common GitHub Commands ⌨ | |
#To create a new repository locally: | |
git init | |
#To add files to staging area: | |
#i.e. git add . OR git add ~filename~ | |
git add octocat.txt | |
git add * | |
git add '*.txt' | |
#To check status of staging area: | |
git status | |
#To commit new changes: git commit -m "commit message" | |
git commit -m "add comment line" | |
#To create a new branch: | |
git checkout -b ~branch name~ | |
#To switch between branches: | |
git checkout ~branch name~ | |
#To merge branches together: | |
git merge ~branch name~ | |
#To add a remote repository: | |
#i.e. git remote add ~remote name~ ~https://yourremoteurl~ | |
git remote add origin https://github.com/dvsbharadva/python_test.git | |
#To pull changes from a remote repository: | |
git pull ~remote name~ ~branch name~ | |
#To push changes to a remote repository: | |
git push ~remote name~ ~branch name~ | |
#To remove the remote-repo to push | |
git remote remove <origin> | |
#To remove the unused or unnecessary file from git repo | |
git rm --cached <filename> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Added a few more commands