Git 入门快速指南 + Mac 上的 GitX 和 Xcode 项目?

发布于 2024-10-05 23:53:43 字数 420 浏览 8 评论 0 原文

在 Mac 上使用 Git 感觉非常痛苦,而且 Git 文档也很糟糕。也许有人有一篇绝密的博客文章甚至截屏视频可以分享,这可以相当简单和快速地解释基础知识?

  • 创建存储库。非常痛苦。

  • 使用 GitX 打开该存储库:Pain。

  • 在 Xcode 中工作,然后提交更改:不知道,可能也很痛苦。

  • 将存储库克隆给其他一些拥有自己 Mac 的开发人员,以便他们可以开始在该项目上进行协作:天啊,我的头爆炸了...需要医生!

  • 以某种方式将这些克隆的存储库合并回来,这样每个人都会得到一个

现在我觉得我需要一个月的时间来理解它。如果有人能指出真正有用的资源,而不强迫我阅读几天,我会很高兴……或者有一本很棒而薄的书可以解释这种疯狂吗?

Using Git on the mac feels like a huge pain, and the Git documentation is just huuuuuuuuge. Maybe someone has a top secret blog article or even screencast to share, that explains the basics fairly simple and quickly?

  • Creating a repository. Big pain.

  • Opening that repository with GitX: Pain.

  • Working in Xcode and then committing changes: No idea, probably big pain too.

  • Cloning the repository to a few other developers with their own macs so they can start collaborate on the project: Oh man, my head explodes... need a doctor!

  • Merging those cloned repositories back somehow, so everyone gets an updated repository with the changes of anyone else: Red alert!

Right now I feel I'll need a month to grok it. Would be SO glad if someone can point out really helpful resources that don't force me to read for some days... or is there a great and thin book that explains this madness?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

酷到爆炸 2024-10-12 23:53:43

Git 绝对是巨大的,你当然可以花那一个月的时间来学习它的流程,但你可以坚持一些基本概念,最终得到一个非常好的工作流程。我使用命令行,因为它可以让您坚持这些基础知识,并在需要时进行扩展。这些基本命令是“pull”、“push”、“init”、“commit -am “message””。稍后,您可以在 gitref.org 阅读有关分支和变基的信息。

作为 mac Xcode + git 用户;我绝对推荐 DTerm,让生活变得轻松。一个键命令会打开一个浮动终端窗口,CD 到当前活动文件的目录。在 XCode 中,这意味着您将立即进入 git 控制的目录。

所以,我的工作流程 -

  1. 在终端中使用“git init”创建存储库
  2. 创建 github 存储库
  3. 按照 github 说明将两者关联起来
  4. 在我的项目中工作时,按 Shift-Command-Enter 调出一个浮动终端窗口,
  5. 输入“git commit -am“提交消息”提交所有当前更改
  6. 相同的组合键加上“git pull”或“git push”分别用于从代码存储库中提取更改或将更改推送到代码存储库

我发现命令行允许更容易与 git 的工作关系比 GitX 更重要,特别是如果您使用 DTerm 之类的东西

,请查看 gitref.org。 .祝你好运!

Git is absolutely enormous, and you could certainly spend that month learning its processes, but you can stick to some basic concepts and end up with a really great workflow. I use the command line, as it allows you stick to these basics, and expand out if you need to. These basic commands are "pull", "push", "init", "commit -am "message"". Later, you can read about branches and rebasing at gitref.org.

As a mac Xcode + git user; I definitely recommend DTerm to make life easy. One key command brings up a floating terminal window, CDed to the directory of the file that's currently active. In XCode, this means that you'll be in a git-controlled directory immediately.

So, my workflow --

  1. Use "git init" in the terminal to create a repository
  2. Create github repository
  3. follow github instructions to associate the two
  4. When working in my project, press Shift-Command-Enter to bring up a floating terminal window
  5. type "git commit -am "commit message" to commit all current changes
  6. Same key combo plus "git pull" or "git push" for pulling in changes from code repository or pushing changes to code repository, respectively

I find that the command line allows a much easier working relationship with git than GitX, especially if you're using something like DTerm.

For a great reference, check out gitref.org. Good luck!

心碎的声音 2024-10-12 23:53:43

启动终端窗口。

创建存储库:

cd project-dir
git init

在 GitX 中打开存储库:

cd project-dir
gitx

提交更改:(

git status
git add .  # or individual files
git commit

最好从头开始设置 .gitignore 文件。)

阅读 Pro Git 书籍或观看 中的一些视频教程git-scm.com 快速入门。 Linus 的文章主要是对实现的描述以及对其他 VCS 的咆哮;第二个视频真的很有用。

Launch a terminal window.

Creating a repository:

cd project-dir
git init

Opening the repository in GitX:

cd project-dir
gitx

Committing changes:

git status
git add .  # or individual files
git commit

(it's a good idea to set up a .gitignore file from the beginning.)

Read the Pro Git book or look at some of the video tutorials at git-scm.com to get started quickly. The one by Linus is mostly a description of the implementation plus rant against other VCSs; the second video is really useful.

梦萦几度 2024-10-12 23:53:43

我在 OSX 下使用 git 大约 6 个月(尽管不是在 Xcode 下使用)。这是一种享受!但是,是的,这是一次痛苦的经历,有时也是一个陡峭的学习曲线,特别是当项目中的其他人都是 Windows 开发人员(有更多 git 客户端选择)和反 OSX 开发人员(不愿意或无法提供帮助)时。但从长远来看,这是值得付出努力的。这是可行的!一旦掌握了基础知识,您就会发现它比 Subversion 好 10 倍。合并就可以了。冲突或多或少已成为过去。

但我的建议是,忘记 GitX,它很糟糕。我开始使用它,很快意识到它不会做(或者至少 18 个月它没有做)任何你无法通过命令行轻松完成的事情。它的作用也少了很多。所以无论如何你最终都会进入终端......而这是来自一个通常由于自己的无能而讨厌使用终端的人!如果您想要一个像样的前端客户端,请尝试 Syntevo 的 SmartGit。一旦我发现我很快就爱上了 Git。

还建议阅读 larsmans 提到的 Pro Git 电子书。

I used git under OSX for about 6 months (albeit not with Xcode). It's works a treat! But yes, it was a painful experience and a steep learning curve at times, especially when everybody else on the project are Windows developers (with more choice of git clients) and anti OSX (unwilling or unable to help). But it's well worth the effort in the long run. It's doable! Once you've got the basics, you'll find it's 10x better than say Subversion. Merges just work. Conflicts become more or less a thing of the past.

But my advice, forget GitX, it's crap. I started off with it, soon realised it doesn't do (or at least 18 months it didn't do) anything you can't easily do from the command line. It also does a whole lot less. So you end up in the terminal eventually anyway... and that's coming from someone who normally hates using the Terminal due to own incompetence! If you want a decent front end client, try Syntevo's SmartGit. Once I'd found that I quickly grew to love Git.

Also recommend reading the Pro Git ebook, mentioned by larsmans.

我的奇迹 2024-10-12 23:53:43

理解 Git 的简单性是很困难的。如果您对其他(集中式)版本控制系统有一些经验,请尝试忘记它们并理解 Git 的基本概念(对象、提交、分支……)。那里有很多书。我会推荐简短的(30页长)Git from Bottom Up,它是免费的并且非常有用。另一个免费学习材料位于 gitcastsPragprogpeepcode 还有很棒的书籍和截屏视频。它们不是免费的,但很有用。

我将 git 与 XCode 一起使用了几个月,它们一起工作。尽管 XCode 尚未将 git 列为受支持的版本控制系统,但您可以从命令行使用 git。我尝试使用 GitX,但从未发现它比命令行中的 git 更有用。尝试一下,也许它更适合你的习惯。

对于 XCode,我发现这个 gitignore 和 gitattributes 文件对我的项目有用:

.gitignore:

# xcode noise
build/*
*.pbxuser
*.mode1v3
*.mode2v3
*.perspective
*.perspectivev3

# osx noise
.DS_Store
profile

# other
.svn
*.swp

.gitattributes: *.pbxproj -crlf -diff -merge

Understanding the simplicity of Git is hard. If you have some experiences with other (centralized) version control systems, try to forget them and understand Git's basic concepts (objects, commits, branches,..). There are lot of books out there. I would recommend the short (30 pages long) Git from bottom up, it is free and very useful. Another free learning materials are at gitcasts. Pragprog and peepcode have also great books and screencasts. They are not free, but useful.

I use git with XCode for several months, and they work together. Although XCode hasn't git listed as a supported version control system, you can use git from the command line. I tried to use GitX, but never found it more useful then git from command line. Try it out, maybe it fits your habbits more.

For XCode I found this gitignore and gitattributes file useful for my projects:

.gitignore:

# xcode noise
build/*
*.pbxuser
*.mode1v3
*.mode2v3
*.perspective
*.perspectivev3

# osx noise
.DS_Store
profile

# other
.svn
*.swp

.gitattributes: *.pbxproj -crlf -diff -merge

听不够的曲调 2024-10-12 23:53:43

我发现 Git Book 是一个非常有用的资源。它用简单的术语解释了基础知识,并没有试图通过深入研究所有功能背后的技术推理来使事情变得过于复杂。至少这是我从中得到的。

I found the Git Book to be a really helpful resource. It explains the basics in simple terms and doesn't try to over-complicate things by going into the technical reasoning behind all the features. At least that's what I got from it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文