Git workflow for single user

前端 未结 3 946
梦毁少年i
梦毁少年i 2021-02-02 13:00

I am a single man shop developing a handful of desktop applications and websites. I started using GIT for version control a few months ago, and I am reasonably happy with it, bu

相关标签:
3条回答
  • 2021-02-02 13:45

    I never pull anything from the Git repository (the working copy is still there, would it get overwritten by Git?),

    With git, the "working copy" is a repository! The "pull" command is for pulling changes from other repositories. As a single developer you do not need it.

    and I am not quite sure what would happen if I created a branch (Where is the branch created? Same folder?)

    In your local repository, yes.

    It's fine, and even a basic set-up like this has advantages, but I feel that I am missing the point.

    Most of git's "new exciting" features are geared towards collaboration. Remember that it was developed to support the development of the Linux kernel, where literally hundreds of people contribute and simply keeping track of and merging the commits is a full-time job. Some of the features are useful pretty much only in such an extreme scenario.

    But there are also some big advantages for single developers.

    What should the workflow be like for a one-man shop?

    Your current workflow is OK (assuming that you make regular backups; a remote repository can server that purpose as well). It could be improved by using feature branches. This allows your version history to be cleaner when you work on several things at the same time (and can prevent serious mistakes sometimes).

    A somewhat related, very useful git feature is the stash.

    0 讨论(0)
  • 2021-02-02 13:45

    I never pull anything from the Git repository

    clone / pull / push commands are for interacting with ohter repos (e.g. repos in other dir using git's file:// protocol)
    Maybe that's what you are missing here (e.g. import parts of your other git repos, begin new project based on another repo and so on)

    would it get overwritten by Git?

    Almost everything in git may be recovered. Just one condition: you should have been commited it before. So commit early, commit often, and it will be fine.

    and I am not quite sure what would happen if I created a branch (Where is the branch created? Same folder?)

    A branch is just a specific commit. So it is created where all your commits are.

    0 讨论(0)
  • 2021-02-02 13:49

    I think for your purpose exactly how you use it is fine. Branches are created in the same repository as your working copy.

    Maybe you should consider making some backup copies for your git projects to another machine. Then you can just push your changes there and don't loose your work if your computer crashes.

    0 讨论(0)
提交回复
热议问题