0

I've used Perforce for about 10 years, and now having to switch to Git for a new job.

Say I have a recent test regression. The way I would go about debugging it in P4 is create two work areas: one sync'ed to an older CL (with passing test), and one to ToT (top of tree) and then I could add some extra logging code to both and compare the logs from the two runs, or even compare the code directories to see what's changed.

Given that in Git switching branches happens on top of the same physical files on my computer, I am unable to have the two codes side by side.

I there a best practice for doing what I need here? Should I "git clone" the same repo to another directory on my computer and sync it to an older commit?

omouri
  • 15
  • 1
  • 6
  • 3
    `git bisect` automates finding the commit that introduced a bug, or you could use `git worktree add` to make checkouts of whatever history you want if you prefer doing it manually. – jthill Jul 18 '22 at 20:15
  • @jthill, I think `git worktree` is what I was looking for. Thanks! `git bisect`, while probably not applicable to my current issue, looks like a great tool to be familiar with. Thanks for the reference. – omouri Jul 18 '22 at 21:16

1 Answers1

1
  1. Yes, you can have as many clones of single repo, as you want
  2. From my POV also, for up-to-date Git using worktrees is more efficient and brain-powered way, as @jthill noted
  3. git bisect is anyway best and real Git-style way of debug history of repo
Lazy Badger
  • 94,711
  • 9
  • 78
  • 110