Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git_pull_vs_git_fetch.md #1933

Merged
merged 2 commits into from
Mar 13, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions docs/gemstones/git/git_pull_vs_git_fetch.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Using git pull and git fetch
author: Wale Soyinka
contributors:
contributors: Ganna Zhyrnova
tags:
- Git
- git pull
Expand All @@ -10,33 +10,33 @@ tags:

## Introduction

This Gemstone explains the differences between `git pull` and `git fetch` commands. It also outlines when to appropriately use each command.
This Gemstone explains the differences between `git pull` and `git fetch` commands. It also outlines when to use each command appropriately.

## Git Fetch vs Git Pull

### Git Fetch

git fetch downloads changes from a remote repository, but doesn't integrate them into your local branch.
git fetch downloads changes from a remote repository but doesn't integrate them into your local branch.

It is especially useful for seeing what others have committed without merging those changes into your local branch.
Seeing what others have committed without merging those changes into your local branch is beneficial.

1. List the currently checked out branch
1. List the currently checked-out branch
```
git branch
```
2. Fetch changes from the main branch of a remote repo named origin. Type:
```
git fetch origin main
```
3. Compare the changes beween the HEAD of your local repo and remote origin/main repo.
3. Compare the changes between the HEAD of your local repo and the remote origin/main repo.
```
git log HEAD..origin/main
```

### Git Pull

Git Pull downloads changes and merges them into your current branch.
Useful for quickly updating your local branch with changes from the remote repository.
It is useful for quickly updating your local branch with changes from the remote repository.

1. Pull and Merge Changes**:
```
Expand All @@ -59,4 +59,4 @@ Useful for quickly updating your local branch with changes from the remote repos

## Conclusion

Understanding the distinctions between `git fetch` and `git pull` is vital for effective Git workflow management. It is important to choose the right command based on your requirements when working or colloborating via version control systems like github, git, gitlab, gitea and so on.
Understanding the distinctions between `git fetch` and `git pull` is vital for effective Git workflow management. Choosing the right command based on your requirements is important when working or collaborating via version control systems like GitHub, GitHub, GitHub Labs, Gitea, etc.
Loading