/git-github

This repo contains the basics git commands.

Git commands

Discarding All Local Changes

$ git restore .
This change is irreversible so be sure before restoring previous local version.

Deleting a Git branch

Local: $ git branch -d branch_name or $ git branch -D branch_name
Remote: $ git push -d <remote_name> <branch_name> eg: $ git push -d origin <branch_name>

List all remote branches

$ git branch -r

Add remote branch to local

$ git fetch <remote_name> <remote_branch>:<local_branch>
$ git checkout <local_branch>

change remote git repository

$ git remote set-url origin <repo link>

Set up Upstream Remote

$ git remote add upstream <repo name>

Fetch an upstream pull request on local

$ git fetch upstream pull/<pull request no>/head:<local branch name>

Resources to learn

Gir rebase