Right, the downside of running "git fetch" is that it makes it harder to see 
changes to the current branch.  I like to run "git pull --all" (especially in 
my "daffodil-asf" checkout) and then "git log ORIG_HEAD..HEAD" and "git diff 
ORIG_HEAD..HEAD" which shows me what changed in the current (main) branch since 
my last pull.  That's why I like to have two checkouts, one of the upstream 
repo as well as one of my forked repo, so I can run these git pull/log/diff 
commands.

-----Original Message-----
From: Steve Lawrence <slawre...@apache.org> 
Sent: Thursday, September 2, 2021 4:37 PM
To: dev@daffodil.apache.org
Subject: EXT: Re: Main development branch name change?

Yeah, it's probably safer to track your forks main branch instead, e.g.

 git branch -u origin/main main

The idea of separate 'main' branches for asf or origin is also probably a good 
idea as well to be extra safe.

Another thought if you want to be super safe, it might even make sense to not 
even have a local main branch. There's really nothing that requires it.

Our workflow recommends to do all work in a bug specific branch based off of 
main, e.g.

  git checkout -b daffodil-123-foo asf/main

Which doesn't need a local main, and makes it pretty hard to push to asf/main 
accidentally.

And if you ever need to build from asf/main just to test or make a quick 
experimental change or something, you can always go into a detached HEAD state, 
e.g.

  git checkout asf/main
  edit ...
  sbt test

Since you're on a detached HEAD, it would be pretty difficult to accidentally 
push to main.

And if you ever want to update your fork's main, you can do something like

  git fetch asf
  git push origin asf/main:main

And in the rare case we need to force push main (maybe to undo a bad merge or 
something) we can manually create a main off of asf/main, do the fix, then 
delete the local main.

There's maybe some potential downsides of it not being very obvious what's been 
added to main during a fetch.

- Steve


On 9/2/21 3:39 PM, Interrante, John A (GE Research, US) wrote:
> Steve,
> 
> I'm fine with adding the Daffodil repos to the Conscious Language Checker 
> scans (opt-in) since we've already done the work.
> 
> I noticed your instructions for updating local checkouts of forked repos 
> differ slightly from the instructions I see on GitHub after I rename my 
> forked repo's default branch to 'main'.  After I follow GitHub's 
> instructions, my checkout's main branch keeps pointing to my forked repo's 
> main branch like it did before:
> 
> On branch main
> Your branch is up to date with 'origin/main'.
> 
> After I follow your instructions, my checkout's main branch points to Apache 
> Daffodil's upstream repo's main branch instead:
> 
> On branch main
> Your branch is up to date with 'asf/main'.
> 
> Is that orientation really advisable?  Sure, it would be nice to avoid 
> needing to rebase my checkout's main branch on asf/main every now and then to 
> keep my main branch in sync, but if I push anything from my checkout's main 
> branch, it could go directly to the upstream repo instead of my forked repo.  
> 
> I prefer to have two checkouts instead, one named "daffodil-asf" which tracks 
> the upstream repo and another named "daffodil-tuxsf" which tracks my forked 
> repo with "origin" set to my repo and "asf" set to the upstream repo.  If I 
> ever need to push directly to the upstream repo (say to create a new upstream 
> branch), I'll do it in daffodil-asf, otherwise I'll do all of my work and git 
> pushes in daffodil-tuxsf with the certainty that everything I push goes to my 
> forked repo, not the upstream repo.
> 
> John
> 

Reply via email to