Skip to content

Instantly share code, notes, and snippets.

@dvsbharadva
Last active October 2, 2024 00:00
Show Gist options
  • Save dvsbharadva/299cbc634c4d0d9da5cd32f4f9864df8 to your computer and use it in GitHub Desktop.
Save dvsbharadva/299cbc634c4d0d9da5cd32f4f9864df8 to your computer and use it in GitHub Desktop.
Try this useful common git commands
⌨ 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>
@dvsbharadva
Copy link
Author

Added a few more commands

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment