[Git] GitHub
GitHub
- Git Remote
- Git Push
Git Remote
- In Git,
Remote
is the destination where the repository is on Cloud- Mostly the remote repository are stored in GitHub, GitLab, etc.
# get the current repo's remote
# -v for more info(verbose)
git remote
git remote -v
# set the current repo's remote(git remote add {name} {url})
# origin is a conventional git remote name
git remote add origin https://github.com/repo_name/repo.git
# renaming git repo name(git remote rename {old_name}){new_name}
# not commonly used
git remote rename origin new_origin_name
# delete remote (git remote remove {remote_name})
git remote remove origin
Git Remote
- pushing to remote repository
#git push {remote} {branch}
git push origin my_branch
# pushing a branch to the remote repository with different name(not normal)
# git push {remote} {my_branch}:{remote_branch}
git push origin local_branch:remote_branch
# -u options means upstream, when set can just use 'git push'
git push -u origin my_branch
# same as above
git push --set-upstream origin my_branch
git push # afterwards