To begin, all you have to do is sign into a GitHub account and then create a new repository, this creates a URL pointing to this remote repo. In this post, I am considering GitHub as this is the place I first started keeping my git repositories. There are quite a few popular cloud-based git hosting repositories such as – GitLab, BitBucket, GitHub, Perforce and CloudForge to name a few. With this in mind, moving forward we shall see more ways to manage a remote repo and how do we sync up our local work with the remote.įirst and foremost, you need to decide on a location you want to place your remote repo on. This is achieved by declaring the remote repository as bare by using the ‘ -bare‘ flag at the time of initializing it as a git repository.īy doing so, your repo is created with git metadata or in other words git objects stored under the hidden ‘.git’ directory alone and no working copy is available for anyone to directly add data. This is done to restrict the direct changes made on the remote repository.īare repository concept is an added advantage for a remote repository to keep it protected and be used for its sole purpose of sharing the code among team members. It is ideally hosted on a cloud or on a server (local or remote) on the internet or your local network.Ī remote repository is just like your local git repository, except that it is generally declared as a bare repository so in order not to have a working copy like your local one. This article fills the gap between picking up our data from your local repository and taking it to the next layer called the remote repository.Ī database of collected information stored in a location that can be shared with your teammates by giving them access. Yes, it is! However, as indicated in the diagram below your data is still in on the local database after you commit it and not shared with your colleagues yet. Isn’t my data already stored in a git database? This inspires us to push our data to the next level “Remote repo” to publish it on a remote repository. I assume that you have mastered the art of editing, adding and moving your data from your working directory(filesystem) to the Staging area and finally committing it to your local repository(database). This is where the concept of remote repositories come into the picture. Starting our discussion from here, let us focus on how git helps you to collaborate and share your work with the peers so that everybody can work on the same code simultaneously without corrupting each other’s data. Some of the key features of git are its speed, distributed nature, security, painless branching and merging along with collaborative work among multiple contributors. Git, as you know, is the most popular versioning tool used today to store, track and version any kind of data. Regularly deleting local references to remote branches is a good practice for maintaining a usable Git repository.Your work adds more value when published and shared with the world(or your team) !!! Getting started Don't slow yourself down by forcing yourself to sift through data you no longer need. Keeping your Git repository tidy may not seem urgent at first, but the more a repository grows, the more important it becomes to prune unnecessary data. That's it! Maintaining your Git repository Next, prune the local reference to the remote branch: $ git remote prune origin Delete the local reference to the remote branch.įirst, list all the branches that you can delete or prune on your local repository: $ git remote prune origin -dry-run In this example, test-branch is the name of the topic branch that you deleted in the remote repository.ģ. Checkout the central branch of your repository (such as main or master).
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |