"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
James Cook <falsifian@falsifian.org>
Subject:
Re: What is the difference between got update and got fetch?
To:
Kurkii <kurkiie@protonmail.com>
Cc:
"gameoftrees@openbsd.org" <gameoftrees@openbsd.org>
Date:
Sat, 1 Jul 2023 13:56:56 +0000

Download raw body.

Thread
On Sat, Jul 01, 2023 at 11:23:38AM +0000, Kurkii wrote:
> Hello, what is the difference between `got update` and `got fetch`?

"got fetch" downloads commits from another repository. It doesn't make
any changes to your work tree.

"got update" updates the files in your work tree to match a different
commit which is already stored on your computer. It doesn't download
anything.

For example, here is how you can fetch new commits on the "main" branch
from the remote called "origin" and rebase your local "main" commits on
those:

$ got fetch origin
$ got update -b origin/main
$ got rebase main

Here, the "got fetch" command updated "origin/main" to include any new
commits. Then "got update" switched your local work tree to the
"origin/main" branch, and then "got rebase" rebased any local commits
you hadn't yet sent upstream.

In that example, "got update" switched branches because of the "-b"
option. It can also be used to switch between commits on the same
branch, using the "-c" option. For example, if you wanted to examine an
old version of a file.

-- 
James