Github and Gitlab
Git is a useful tool and is also confusing for many newbies. This tutorial is trying to put a few useful tips
Git is a useful tool and is also confusing for many newbies. This tutorial is trying to put a few useful tips
Switching between GitLab and GibHub
Switching between GitLab and GibHub
Suppose you have a code repository, either on github or gitlab, you want to switch from to another, what you need to do is to change the origin. Here are the steps:
figure out your current origin by:
git remote -v
delete the current remote by:
git remote remove origin
change the remote to a different one by:
git remote add origin https://gitlab-token-name: token@gitlab.com/myuser/myrepo.git
git branch -M main
git push -uf origin main
If you have several branches and would like to push them all, do the following
git push --all
Git branch
Git branch
To check the available branches,
git branch -a
To checkout a branch
git checkout -b my-new-branch
To switch between branches:
git switch new-branch