RUVIDEO
Поделитесь видео 🙏

Pulling & Fetching Changes from a Remote [Learn Git Video Course]

Learn how you can download new changes from the remote server with Git. You'll also learn the difference between Fetch and Pull commands. This video part of our free 24-part video course on Learning Git on the Command Line.
Subscribe ► https://www.youtube.com/channel/UCrl5xG-L4ZCFkR-bhUy9BVg?sub_confirmation=1

***************************************

Additional Git tutorials and resources

Learn Git on the Command Line: a free 24-part video course ► https://www.youtube.com/watch?v=M-O8ZNW9icQ&list=PLyCj4RCToz5DRDx3sJ4iW9i8D2G8OdHYH

Surviving with Git: https://www.youtube.com/playlist?list=PLyCj4RCToz5AKiAKycmAZcTZron_yANQT

***************************************

Today, we'll learn how to download new changes from a remote repository. First, it's important to know that there are two different commands for downloading changes: Fetch and Pull.
Before we talk about the differences between Fetch and Pull, you need to understand one thing: in order to see NEW remote data, you need to explicitly update.
I'll make an example. Let's say you're working on a project - together with a teammate. Your teammate then pushes his changes to the common remote. And here's the important thing: you will NOT know about this new data on the remote - until you explicitly request it.
When you do so, for example by performing a "Fetch", Git makes a snapshot of the data on the remote. And it downloads it to your local repository. This means that, when you're looking at branches or commits, you only look at that snapshot in your local repository. And this is only as fresh as your last update.

So, if you should ever wonder why you don't see your teammates' new commits, it's probably because you're looking at an old state and haven't updated, yet.

As said, Fetch downloads all the data from the remote repository. It saves it in your local repository, and this allows you to see what happened on the remote.

The other command is "pull". Pull also downloads new data, but it also integrates it directly into your working copy. It merges new commits into your current HEAD branch.

And this is the difference between the two: Fetch only downloads new data from a remote; but it leaves your working copy untouched. Fetch is great to stay up-to-date on what's new on the remote. You can then decide what you want to integrate and what not.
Pull also downloads, but it also directly integrates new commits into your current HEAD branch. You could describe it as a Fetch and a Merge operation.

We'll do all of this in practice in our video.

First, we need to get an overview of where we are. "git branch -vva" shows us both our local branches and our remote ones. However, as said, this information is only as fresh as our last update. So let's perform a "git fetch" on our "origin" remote to see what's new. Already in the output here, we see that a couple of things happened on the remote. To take a closer look, we perform "git branch" again.

We're instantly told that there are new commits on the remote master branch. Git tells us because we established a "tracking connection" between our local master and its remote counterpart.
Let's integrate these commits into our local version of the master branch. First, we make sure we are on master, currently. Then, we perform "git pull".

The full "git pull" command actually expects two more parameters: the remote and the branch on that remote from which to pull. However, with our tracking connection in place, Git already knows this - and we can just type a plain "git pull".

Now, after executing this, our local master branch contains all the new commits from the remote master.

When we perform "git branch" once more, we see that there's a new "feature/signup" branch on the remote. Let's say we want to start working on this topic. To do that, we need to create a local copy of that branch. You cannot work on a remote branch because working involves files in your working copy. And your working copy always contains the files of your local HEAD branch.

So, let's create a local copy of that remote "feature/signup" branch.

Type "git checkout", followed by the "track" parameter. Our new local branch will then have a tracking connection to that original remote branch. Lastly, tell Git which remote branch you mean.

We now have a local version of that branch that we can work with.

SUBSCRIBE to learn more about Git, Tower, and how to become a better developer!
https://www.youtube.com/channel/UCrl5xG-L4ZCFkR-bhUy9BVg?sub_confirmation=1

For more free ebooks, cheat sheets, and video tutorials make sure to check out our FREE learning platform!
https://www.git-tower.com/learn/

STAY UP-TO-DATE:
Tower: https://www.git-tower.com
Twitter: https://twitter.com/gittower
Facebook: https://www.facebook.com/gittower

#git #learngit #gittutorial

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Pulling & Fetching Changes from a Remote [Learn Git Video Course]», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.