Skip to content

Instantly share code, notes, and snippets.

@netfantom-spb
Last active March 29, 2024 06:31
Show Gist options
  • Save netfantom-spb/ccca4255b31a907f76b8a549ce17778c to your computer and use it in GitHub Desktop.
Save netfantom-spb/ccca4255b31a907f76b8a549ce17778c to your computer and use it in GitHub Desktop.
GIT and GitHub

Reset all local changes and reload remote branch ("main" in this example)

$ git checkout main
$ git fetch --all
$ git reset --hard origin/main

Change remote reposictory URL

$ git remote -v
origin  [email protected]:netfantom-spb/oldrepository.git (fetch)
origin  [email protected]:netfantom-spb/oldrepository.git (push)
$ git remote set-url origin [email protected]:netfantom-spb/newrepository.git

Git submodule

Add submbodule

git submodule add http://...

Change push url

In submodule dir:

git remote set-url --push origin http://...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment