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

  1. Open your terminal or command prompt and navigate to your local Git repository’s directory.

  2. Verify the current remotes configured for your repository by running:

    bash

    git remote -v
    

    This command lists the names and URLs for the fetch and push operations of your remotes, e.g., origin https://github.com (fetch).

  3. Remove the origin remote by using one of the following commands:

    • bash

      git remote remove origin
      
    • bash

      git remote rm origin
      

    The remove form is generally preferred, but rm is a valid alias.

  4. Verify the removal by running git remote -v again. The origin remote 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 add command:

    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”