开发者

How to auto versioning in Git with XCode 4?

I am a SCM newbie, but I just need some basic things for version control.

I am using Git in XCode 4.

the questions are :

How can I automatically give my project a versioning number (such as 1.1.2) when I commit it to the local Git repositories?

Is Git's versioning number meant to be associated with my app releasing number? I mean for example, if my working copy's ve开发者_JAVA技巧rsion is 1.2.3 in Git, then will the version in my info.plist be changed to 1.2.3 as well?

Thanks


Git's versioning is NOT meant to be related to your app release number. There's not really any such thing as "version 1.2.3 in Git". Git commits are referred to by either a SHA hash, a branch name, or a tag name.

Most people who handle in version numbers use git tags to identify the final released version of their product with one of those. So, you commit your very last fixes to your testing branch, it tests clean, you merge it into your production branch, and tag that commit with the next version number.

There ARE ways of making that tag action update the version number on your project in Xcode, but nothing out of the box, and there's no gui interface for it that I know of. You'd have to write a custom hook in your git repository.

Also, if you're using Xcode4's interface to git, you're really not using git how it's meant to be used. Git is an amazing tool that Xcode gives you a tiny (and wrong-headed) interface on. It's worth learning it. I'm so disappointed with the Xcode interface to git, I don't even use it anymore. I do my work in Xcode and manage my repository on the command line.


I was using SVN version numbers in my bundle identifier...and have now moved to git. Instead of git commit checksums, i now use the log line count as the version number.

this is my runscript:

REV=`git log --pretty=format:'' | wc -l | sed 's/\ //g'`
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $REV" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜