This blog will illustrate the method of updating the Git clone.
How to Update Git Clone?
To update the Git clone, try out the below-mentioned steps:
- Navigate to the particular local repository and list its content.
- Switch to the cloned repository and view its content and commit history.
- Update cloned repository using the “git pull” command.
- Ensure changes.
Step 1: Redirect to Local repository
First, switch to the desired local repository:
Step 2: View Repository Content
Then, enter the below-listed command and list the current repository’s content:
It can be seen that the current repository contains two files and one cloned repository:
Step 3: Navigate to Cloned Repository
Switch to the cloned Git repository using the below-provided command:
Step 4: View Cloned Repository Content
Now, display the content of the cloned repository:
In the below output, the content of the cloned repository can be seen:
Step 5: View Commit History
Next, run the given-provided command to view cloned repository’s Git log:
It can be observed that the HEAD is pointing to the “851eee2” commit id:
Step 6: Update Cloned Repository
To update the cloned local repository, fetch and merge the changes of the remote repository, execute the below-listed command:
Step 7: Verify Changes
After that, view the Git log to verify whether the changes have been added to the locally cloned repository or not:
As you can see, the HEAD is now pointing to the most recent commit of the remote repository and changes have been added to the cloned repository:
Step 8: View Updated Content
Lastly, list the content of cloned repository to view changes:
It can be observed the content of the cloned repository has been updated successfully:
That was all about updating the Git clone.
Conclusion
To update the Git clone, first, navigate to the locally cloned repository. Then, view its content and commit history. Next, execute the “git pull” command to fetch and combine the content of the remote repository and update the cloned repository. Lastly, ensure changes by checking Git log. This blog illustrated the method of updating the Git clone.