34

**Overheard new intern struggling with git talking to lead developer

Intern: "I am having trouble with the git repo on my local machine, can you take a look?"

*** Looks at code for three seconds

Lead developer: "Yeah, I suggest you just delete and reclone the repo."

Comments
  • 6
    Yeah. I do the same.
    Just saves lot of time.
  • 5
    @zotigapo Recloning or advicing someone else to reclone?
  • 9
    Not a nice lead developer. Could at least give the intern the knowledge on how to `git reset --hard origin/master`.
  • 5
    @k0pernikus No, that way you lose your work of 3 days you forgot to commit or push.
    You need to clone the repo anew, copy your work over and push it. THEN you delete the old repo.
  • 4
    @gathurian If you commit, than a hard reset is no problem since you can use git reflog.

    My workflow is commit often and clean up before pushing/merging (rebase -i).

    Generally I try to follow the "commit often" mantra, even if I have tons of 'WIP' commits, that way I won't lose any progress when I do some "risky" git operations. In the end before merging you can clean up the commits.
  • 5
    @gathurian If you have savable work, then why would you need to reclone?

    I never had the need to reclone a project and consider making it part of of your worflow an antipattern.

    Fix your state or reset hard.

    If you do atomic commits, and if you commit and push often, what work can you really lose by resetting your broken changes?

    Heck, just stash your broken stage or keep them in a what-the-hell-was-I-thinking-branch if you really need them.
  • 2
    maybe he was trying to be fancy with rebase or did weird shit like changing untracked files, like stuff in node_modules or .git?

    if so, then i agree with just recloning instead of needlessly going on detective mode...

    otherwise grh origin/master the poor dev, no point in retaining any change I guess
Add Comment