单用户的 Git 工作流程
我是一家开发少量桌面应用程序和网站的单身商店。几个月前我开始使用 GIT 进行版本控制,我对它相当满意,但我的使用非常笨拙,我想知道单个用户的工作流程应该是什么样的。
现在,我的每个项目文件夹中都有一个 .git 文件夹。我每隔一段时间就提交一次更改,然后继续处理工作副本。
我从来没有从 Git 存储库中提取任何内容(工作副本仍然存在,它会被 Git 覆盖吗?),并且我不太确定如果创建分支会发生什么(分支在哪里创建?相同的文件夹?)
换句话说,我使用 Git 主要是为了在需要时查看与旧版本的差异,同时仍然以相同的旧方式工作。
很好,即使像这样的基本设置也有优点,但我觉得我没有抓住重点。
一个人的商店的工作流程应该是什么样的?
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, but my usage is pretty clumsy and I am wondering what the workflow should be for a single user.
Right now, I have a .git folder in each of my project folders. I commit my changes every once in a while and I just keep working on the working copy.
I never pull anything from the Git repository (the working copy is still there, would it get overwritten by Git?), and I am not quite sure what would happen if I created a branch (Where is the branch created? Same folder?)
In other words, I am using Git mostly to see differences with old versions when needed, while still working the same old way.
It's fine, and even a basic set-up like this has advantages, but I feel that I am missing the point.
What should the workflow be like for a one-man shop?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对于 git,“工作副本”是一个存储库! “pull”命令用于从其他存储库中提取更改。作为单个开发人员,您不需要它。
在本地存储库中创建一个分支(在哪里创建分支?相同的文件夹?)会发生什么,是的。
git 的大多数“令人兴奋的新”功能都是面向协作的。请记住,它是为了支持 Linux 内核的开发而开发的,实际上有数百人做出贡献,仅仅跟踪和合并提交就是一项全职工作。有些功能只有在这种极端情况下才有用。
但对于单一开发者来说也有一些很大的优势。
您当前的工作流程没有问题(假设您定期进行备份;远程存储库也可以实现该目的)。可以通过使用功能分支来改进它。当您同时处理几件事时,这可以使您的版本历史记录更加清晰(有时可以防止严重错误)。
一个有点相关且非常有用的 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.
In your local repository, yes.
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.
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.
我认为就您的目的而言,您如何使用它就可以了。
分支是在与工作副本相同的存储库中创建的。
也许你应该考虑为你的 git 项目制作一些备份副本到另一台机器上。然后,您可以将更改推送到那里,并且在计算机崩溃时也不会丢失您的工作。
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.
clone
/pull
/push
命令用于与其他存储库交互(例如使用 git 的 file:// 协议在其他目录中的存储库)也许这就是你在这里所缺少的(例如,导入其他 git 存储库的部分内容、基于另一个存储库开始新项目等等)
几乎 git 中的所有内容都可以恢复。只有一个条件:你应该以前就犯过这种事。所以尽早提交,经常提交,那就没问题了。
分支只是一个特定的提交。因此它是在您所有提交所在的位置创建的。
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)
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.
A branch is just a specific commit. So it is created where all your commits are.