Back to Git Course
Git Course
What are Remotes?
Remotes are versions of your repository hosted on the internet (or on a network). Git allows you to work with remote repositories to share your work with others.
Adding a Remote Repository
To add a remote repository we need to use the below command.
git remote add origin <repository-url>
Fetch Changes
To get the latest updates from the remote repository without merging them into your local branch.
git fetch origin
To fetch and automatically merge the changes from the remote.
git pull origin main
Pushing Changes
Once we have committed our changes locally, we can push them to the remote repository.
git push origin main
Delete Branch Remotely
To delete branch remotely using the below command.
git push origin --delete <branch-name>
Lets delete dev/praveen branch from sample1 repo.
D:\praveenoruganti\codeworkspace\gitworkout\sample1>git push origin --delete dev/praveen To https://github.com/orugantipraveen/sample1.git - [deleted] dev/praveen