![]() So, we have quite some amount of unreachable objects which needs clean up. Next check the list of unreachable and unreferenced commits and objects in our repository using git fsck command: $ git fsck -unreachableĬhecking object directories: 100% (256/256), done. First let us check the disk consumption on our git repository used by different objects: $ git count-objects -v So it is a good idea to clean up the unreachable objects. When multiple team members are working on a single repository then over a period of time, the commit history piles up with multiple unreferenced commits which may have been deleted in past. ![]() Scenario-1: git prune unreachable commits from history To practice using git prune, we will first add some commits to the local project prune-exprt and make some of them inaccessible (missing refs). We shall move to the next section, where we will experiment using git prune in different scenarios. Remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 Remote: Counting objects: 100% (3/3), done. Now, we shall proceed to run the git clone command as follows: $ git clone I will be using windows 10 pro and git version 2.32.0.windows.2. Let's clone the remote project prune-exprt to the local workstation for use in this experiment. ![]() To practice using git prune, we shall first set up the lab environment. …: maintain the listed referenced heads history.ĪLSO READ: How to use git revert properly.-: regulates the options to input in the function.-expire : determines the expiry of the wasted objects.-progress: outputs the cleaning progress.-v (-verbose): outputs all the pruned data.-dry-run: this option only reports what has been pruned. ![]() In this tutorial, we are going to explore scenarios that use the prune operator and demonstrate how to apply the prune function in those scenarios. It empties all the mess in a repository and keeps it clean. The git garbage collection command (gc) is the one responsible for sustaining a repository. Understand that the prune function isn’t directly executed and it’s an offspring of the garbage collection command. Git prune operates as a deposable bin for wasted data in the git repository history. Git stale objects examples include tags, commits and changes in git history that cannot be easily traced. ![]() A stale object in git becomes unreferenced and cannot be reached. Git prune is a git function whose main purpose is cleaning stale or dormant objects from a git repository. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |