From: Kurkii Subject: Re: What is the difference between got update and got fetch? To: James Cook , "gameoftrees@openbsd.org" Date: Sat, 01 Jul 2023 15:01:43 +0000 Hi, thank you so much for the explanation! Makes a lot more sense, as the man pages for either option initially looked like the same thing worded differently to me. ------- Original Message ------- On Saturday, July 1st, 2023 at 1:56 PM, James Cook wrote: > 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