Now that you have background knowledge of how remotes and branches work, let's solve our problem and reset a remote branch to origin using the git reset -hard command.īefore you do this (if this your first time), make sure that you back up your branch before you reset it in case something goes wrong. How to Reset a Remote Branch to Origin in Git In summary, origin/HEAD represents the default branch on the remote, which is defined automatically when you clone a repository from the internet. It represents the default branch on a remote and is a local ref representing a local copy of the HEAD in the remote repository. The word origin is an alias that Git created to replace the remote URL of a remote repository. When you clone a repository, you pull data from a repository on the internet or an internal server known as the remote(it looks something like (remote)/(branch)). All branches in What is a Remote Branch in Git?Ī remote branch is a reference to the state of the branches in a remote repository (a version of your project hosted on the internet or on a network like GitHub). ![]() ![]() You can create new branches like prod-staging or prod-current from the main branch. The main branch is always the default branch in a repository and is considered "production and deployable code". Branches help you manage different versions of one project. Basic knowledge of GitHub and repositories.Ī branch is a core concept in Git and GitHub that you'll use all the time. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |