如何以更强大的方式使用版本控制?

时间:2023-01-02 09:31:51

On most of my projects, individual or group, I find that I only use version control to simply pull latest changes and post my own code up.

在我的大多数项目中,个人或团体,我发现我只使用版本控制来简单地提取最新的更改并发布我自己的代码。

However, I know that there is a lot more to version control, what with branches and other powerful features that I don't use.

但是,我知道版本控制还有很多,我不使用的分支和其他强大的功能。

Can someone give me advice on how to use version control in a more powerful way?

有人能给我一些关于如何以更强大的方式使用版本控制的建议吗?

The version control systems I'm mostly talking about are SVN and Git.

我主要谈论的版本控制系统是SVN和Git。

6 个解决方案

#1


You can start here: Red book

你可以从这里开始:红皮书

You create tags for the things you released; you create branches for the things you are working on and could potentially be wrong/unstable. Your trunk should be as stable as possible (man, that didn't sound right).

你为你发布的东西创建标签;你为正在处理的事情创建分支,可能是错误的/不稳定的。你的后备箱应该尽可能稳定(男人,听起来不对)。

#2


Master merging and branching. The thing I find amazing about most uses of version control is that 90% of the people using it don't know how to use it to support two different branches at the same time they use it as a linear versioning system when they check in changes. The real power of version control is that it allows you to effectively maintain two separate versions of a system at the same time which is something that comes in handy when you have to simultaneously support a production version and develop a new version of a piece of software. Learning how to use a tool like Subclipse (and Eclipse plugin for Maven) or a tool like Git to merge changes between branches is something I wish more people using Version Control knew how to do.

掌握合并和分支。我发现版本控制的大多数用途令我惊讶的是,90%的人使用它时不知道如何使用它来支持两个不同的分支,同时当它们检查更改时将它用作线性版本控制系统。版本控制的真正强大之处在于它允许您同时有效地维护系统的两个独立版本,这在您必须同时支持生产版本和开发新版本的软件时会派上用场。学习如何使用像Subclipse这样的工具(和Maven的Eclipse插件)或像Git这样的工具来合并分支之间的变化是我希望更多人使用版本控制知道如何做。

#3


git ready has lots of tips on using Git, from beginner to advanced. See also the Git Wiki for all kinds of documentation and tips on how to use Git.

git ready有很多关于使用Git的技巧,从初学者到高级。另请参阅Git Wiki以获取有关如何使用Git的各种文档和提示。

Here are a few things that are good to learn about and non-obvious.

以下是一些有待学习和不明显的事情。

Rearrange a series of commits:

重新排列一系列提交:

git rebase -i <base-rev>

Find which commit broke your unit tests, in this case, make check; you could use any other command that could check for some particular build failure or bug and exit with a non-zero status on failure:

找出哪个提交破坏了您的单元测试,在这种情况下,进行检查;您可以使用任何其他命令来检查某些特定的构建失败或错误,并在失败时以非零状态退出:

git bisect start HEAD <known good revision>; git bisect run make check

Show useful information about a remote and its branches:

显示有关远程及其分支的有用信息:

git remote show <remote> 

And branching in Git is easier than anything:

而Git中的分支比任何东西都容易:

git checkout -b branch-name master # create a new branch, starting it at master
git pull origin master # merge in changes from the master branch on origin server
git checkout master; git merge branch-name # merge changes you made on the branch
git branch -d branch-name # once you're done with the branch

If you want to share the branch with others while you're working on it, or push it to a server for backup:

如果您想在处理分支时与其他人共享分支,或者将其推送到服务器进行备份:

git checkout branch-name # assuming it's already been created
git push origin branch-name # push the branch to the origin server

#4


Consider putting your build system into revision control. Your tool chain itself may deviate over time and provisioning developer machines becomes comically simply rather than an ordeal. I have also found that versioning test or build artifacts forces you into the discipline of automating. Consider methods of storing other artificats of your software (requirements, milestones, etc). If you have external tools fight duplication with all your might. Consider documenting the build environment within the build system and making it so easy a monkey could boot strap an extract, build, package, advertise, test, package, sign, and deploy.

考虑将构建系统置于修订控制中。您的工具链本身可能会随着时间的推移而发生变化,配置开发人员机器变得简单而不是折磨。我还发现版本控制测试或构建工件会迫使您进入自动化学科。考虑存储软件的其他技术的方法(要求,里程碑等)。如果你有外部工具与你的所有力量斗争重复。考虑在构建系统中记录构建环境,并使猴子可以轻松地启动提取,构建,打包,广告,测试,打包,签名和部署。

#5


I find that version control incredibly useful for isolating and fixing difficult bugs. Specifically, by updating to previous versions, I can find out when the problem was introduced, and then find out what changes were made between the two versions, and easily isolate the problem.

我发现版本控制对于隔离和修复困难的bug非常有用。具体来说,通过更新到以前的版本,我可以找出问题的引入时间,然后找出两个版本之间的更改,并轻松地隔离问题。

#6


Read this: http://oreilly.com/catalog/practicalperforce/chapter/ch07.pdf

请阅读:http://oreilly.com/catalog/practicalperforce/chapter/ch07.pdf

#1


You can start here: Red book

你可以从这里开始:红皮书

You create tags for the things you released; you create branches for the things you are working on and could potentially be wrong/unstable. Your trunk should be as stable as possible (man, that didn't sound right).

你为你发布的东西创建标签;你为正在处理的事情创建分支,可能是错误的/不稳定的。你的后备箱应该尽可能稳定(男人,听起来不对)。

#2


Master merging and branching. The thing I find amazing about most uses of version control is that 90% of the people using it don't know how to use it to support two different branches at the same time they use it as a linear versioning system when they check in changes. The real power of version control is that it allows you to effectively maintain two separate versions of a system at the same time which is something that comes in handy when you have to simultaneously support a production version and develop a new version of a piece of software. Learning how to use a tool like Subclipse (and Eclipse plugin for Maven) or a tool like Git to merge changes between branches is something I wish more people using Version Control knew how to do.

掌握合并和分支。我发现版本控制的大多数用途令我惊讶的是,90%的人使用它时不知道如何使用它来支持两个不同的分支,同时当它们检查更改时将它用作线性版本控制系统。版本控制的真正强大之处在于它允许您同时有效地维护系统的两个独立版本,这在您必须同时支持生产版本和开发新版本的软件时会派上用场。学习如何使用像Subclipse这样的工具(和Maven的Eclipse插件)或像Git这样的工具来合并分支之间的变化是我希望更多人使用版本控制知道如何做。

#3


git ready has lots of tips on using Git, from beginner to advanced. See also the Git Wiki for all kinds of documentation and tips on how to use Git.

git ready有很多关于使用Git的技巧,从初学者到高级。另请参阅Git Wiki以获取有关如何使用Git的各种文档和提示。

Here are a few things that are good to learn about and non-obvious.

以下是一些有待学习和不明显的事情。

Rearrange a series of commits:

重新排列一系列提交:

git rebase -i <base-rev>

Find which commit broke your unit tests, in this case, make check; you could use any other command that could check for some particular build failure or bug and exit with a non-zero status on failure:

找出哪个提交破坏了您的单元测试,在这种情况下,进行检查;您可以使用任何其他命令来检查某些特定的构建失败或错误,并在失败时以非零状态退出:

git bisect start HEAD <known good revision>; git bisect run make check

Show useful information about a remote and its branches:

显示有关远程及其分支的有用信息:

git remote show <remote> 

And branching in Git is easier than anything:

而Git中的分支比任何东西都容易:

git checkout -b branch-name master # create a new branch, starting it at master
git pull origin master # merge in changes from the master branch on origin server
git checkout master; git merge branch-name # merge changes you made on the branch
git branch -d branch-name # once you're done with the branch

If you want to share the branch with others while you're working on it, or push it to a server for backup:

如果您想在处理分支时与其他人共享分支,或者将其推送到服务器进行备份:

git checkout branch-name # assuming it's already been created
git push origin branch-name # push the branch to the origin server

#4


Consider putting your build system into revision control. Your tool chain itself may deviate over time and provisioning developer machines becomes comically simply rather than an ordeal. I have also found that versioning test or build artifacts forces you into the discipline of automating. Consider methods of storing other artificats of your software (requirements, milestones, etc). If you have external tools fight duplication with all your might. Consider documenting the build environment within the build system and making it so easy a monkey could boot strap an extract, build, package, advertise, test, package, sign, and deploy.

考虑将构建系统置于修订控制中。您的工具链本身可能会随着时间的推移而发生变化,配置开发人员机器变得简单而不是折磨。我还发现版本控制测试或构建工件会迫使您进入自动化学科。考虑存储软件的其他技术的方法(要求,里程碑等)。如果你有外部工具与你的所有力量斗争重复。考虑在构建系统中记录构建环境,并使猴子可以轻松地启动提取,构建,打包,广告,测试,打包,签名和部署。

#5


I find that version control incredibly useful for isolating and fixing difficult bugs. Specifically, by updating to previous versions, I can find out when the problem was introduced, and then find out what changes were made between the two versions, and easily isolate the problem.

我发现版本控制对于隔离和修复困难的bug非常有用。具体来说,通过更新到以前的版本,我可以找出问题的引入时间,然后找出两个版本之间的更改,并轻松地隔离问题。

#6


Read this: http://oreilly.com/catalog/practicalperforce/chapter/ch07.pdf

请阅读:http://oreilly.com/catalog/practicalperforce/chapter/ch07.pdf