Git / GitHub Notes
see git config
git config --list
initialize
git init
Check status and see what branch you are on
git status
Rename the branch using the move option (-m):
git branch -m <new-name>
add files to staging
git add .
you can also add just a file
git add file.txt
push local commit to remote (Github)
git remote -v
git remote add origin https://github.com/tipnmog/tipnmogblog.git
git branch -M main
git push -u origin main
Steps to Remove the Origin Remote
-
Open your terminal or command prompt and navigate to your local Git repository’s directory.
-
Verify the current remotes configured for your repository by running:
bash
git remote -vThis command lists the names and URLs for the fetch and push operations of your remotes, e.g.,
origin https://github.com (fetch). -
Remove the
originremote by using one of the following commands:-
bash
git remote remove origin -
bash
git remote rm origin
The
removeform is generally preferred, butrmis a valid alias. -
-
Verify the removal by running
git remote -vagain. Theoriginremote should no longer appear in the list.
After Removal
-
If you need to connect your local repository to a different remote URL, you can add a new remote using the
git remote addcommand:bash
git remote add origin [new_url] -
Alternatively, you can change the existing remote URL without removing it first by using
git remote set-url:bash
git remote set-url origin [new_url] -
To delete a branch on the remote server (not the remote connection itself), you would use a different command:
bash
git push origin --delete [branch_name]Note that this is different from removing the remote configuration for “origin”