迅速に、安全に、そして頭痛のない作業。あなたが一生失っていたGitインターフェースがついに到着しました。
GITは最近10周年を迎えましたが、ほとんどのエンジニアはその複雑さにまだ混乱しています(スタックオーバーフローに関するトップ5の質問のうち3つはGit関連です)。 gitは単純なアクションさえも神秘性コマンドに変換するため(「git add」とステージに「git reset head」を段階的に段階的にしますか?)。レポを台無しにします!
Gitupは、あらゆるレベルのエンジニアが頭痛のないものを迅速に、安全に、そして迅速に機能させることができる新しいGitインタラクションモデルを発明する賭けです。それは、その構築方法(ディスク上のGITデータベースと直接対話する)、動作方法(コミットを操作する代わりにリポジトリグラフを操作する)まで、他のGITクライアントとは異なります。
Gitupを使用すると、Mac用の本当に効率的なGitクライアントを取得します。
Gitupは、開発者がGitと対話する方法を再発明するための賭けとして、2014年後半に@swisspolによって作成されました。数ヶ月の作業の後、2015年初頭にリリース前に利用可能になり、製品ハントと大胆なファイヤーボールが特集されたとともに、ハッカーニュースのトップに到達しました。 30,000行のコード後、Gitupは2015年8月中旬1.0に達し、開発者コミュニティへの贈り物としてオープンソースをリリースしました。
brew install homebrew/cask/gitup
(Note: There is already a formula called gitup, so the full name must be specified!)ドキュメントを読んで、サポートとフィードバックのためにGitHubの問題を使用してください。
リリースノートはhttps://github.com/git-up/gitup/releasesで入手できます。 Builds tagged with a v
(eg v1.2.3
) are released on the "Stable" channel, while builds tagged with a b
(eg b1234
) are only released on the "Continuous" channel.アプリ設定でGitupが使用する更新チャネルを変更できます。
To build GitUp yourself, simply run the command git clone --recursive https://github.com/git-up/GitUp.git
in Terminal, then open the GitUp/GitUp.xcodeproj
Xcode project and hit Run.
IMPORTANT: If you do not have an Apple ID with a developer account for code signing Mac apps, the build will fail with a code signing error. 「アプリケーション」ターゲットの「コード署名ID」ビルド設定を削除して、問題を回避するだけです。
Alternatively , if you do have a developer account, you can create the file "Xcode-Configurations/DEVELOPMENT_TEAM.xcconfig" with the following build setting as its content:
development_team = [your teamid]
これの詳細については、ファイル「Xcode-Configurations/base.xcconfig」の最後にあるコメントを見ることができます。
Gitupは、「gitupkit」と呼ばれる再利用可能なジェネリックGitツールキットの上に薄い層として構築されています。これは、同じgitupkitフレームワークを使用して、独自のgituiを構築できることを意味します。
Gitupkitは、ObjectiveGitとは非常に異なる目標を持っています。 libgit2に広範な生のバインディングを提供する代わりに、gitupkitはlibgit2の最小限のサブセットのみを使用し、その上に他のすべてを再浸透させます(たとえば、独自の「リベースエンジン」があります)。これにより、非常にタイトで一貫したAPIを公開することができ、OBJ-Cの規則に完全に従い、libgit2の複雑さと時には矛盾を隠します。 Gitupkitは、それに加えて、元に戻す/やり直し、スナップショットのようなタイムマシンからドロップインのUIコンポーネント全体に至るまで、多くの排他的で強力な機能を追加します。
Gitupkitソースコードは、パブリックAPIの使用を通じてのみ通信する2つの独立したレイヤーとして編成されています。
基本層(基礎のみに依存し、OS XとiOSと互換性があります)
Core/
: wrapper around the required minimal functionality of libgit2, on top of which is then implemented all the Git functionality required by GitUp (note that GitUp uses a slightly customized fork of libgit2)Extensions/
: categories on the Core
classes to add convenience features implemented only using the public APIsUIレイヤー(AppKitに依存し、OS Xのみと互換性があります)
Interface/
: low-level view classes eg GIGraphView
to render the GitUp Map viewUtilities/
: interface utility classes eg the base view controller class GIViewController
Components/
: reusable single-view view controllers eg GIDiffContentsViewController
to render a diffViews/
: high-level reusable multi-views view controllers eg GIAdvancedCommitViewController
to implement the entire GitUp Advanced Commit view IMPORTANT : If the preprocessor constant DEBUG
is defined to a non-zero value when building GitUpKit (this is the default when building in "Debug" configuration), a number of extra consistency checks are enabled at run time as well as extra logging.このオーバーヘッドは、パフォーマンスに大きな影響を与える可能性があることに注意してください。
gitupkit APIを使用することは、機能(リポジトリ、ブランチ、コミット、インターフェイスコンポーネントなど)によって編成されているため、非常に簡単でなければならず、機能を明確に名前にするために最善の努力が払われています。
「コア」APIについては、それらを学習する最良の方法は、関連する単体テストを熟読することです。たとえば、ブランチAPIのブランチテストを参照してください。
開始するためのサンプルコードを次に示します(エラー処理は、読者へのエクササイズとして残されています):
リポジトリの開設と閲覧:
// Open repo
GCRepository* repo = [[GCRepository alloc ] initWithExistingLocalRepository: <PATH> error: NULL ];
// Make sure repo is clean
assert ([repo checkClean: kGCCleanCheckOption_IgnoreUntrackedFiles error: NULL ]);
// List all branches
NSArray * branches = [repo listAllBranches: NULL ];
NSLog ( @" %@ " , branches);
// Lookup HEAD
GCLocalBranch* headBranch; // This would be nil if the HEAD is detached
GCCommit* headCommit;
[repo lookupHEADCurrentCommit: &headCommit branch: &headBranch error: NULL ];
NSLog ( @" %@ = %@ " , headBranch, headCommit);
// Load the *entire* repo history in memory for fast access, including all commits, branches and tags
GCHistory* history = [repo loadHistoryUsingSorting: kGCHistorySorting_ReverseChronological error: NULL ];
assert (history);
NSLog ( @" %lu commits total " , history.allCommits.count);
NSLog ( @" %@ n %@ " , history.rootCommits, history.leafCommits);
リポジトリの変更:
// Take a snapshot of the repo
GCSnapshot* snapshot = [repo takeSnapshot: NULL ];
// Create a new branch and check it out
GCLocalBranch* newBranch = [repo createLocalBranchFromCommit: headCommit withName: @" temp " force: NO error: NULL ];
NSLog ( @" %@ " , newBranch);
assert ([repo checkoutLocalBranch: newBranch options: 0 error: NULL ]);
// Add a file to the index
[[ NSData data ] writeToFile: [repo.workingDirectoryPath stringByAppendingPathComponent: @" empty.data " ] atomically: YES ];
assert ([repo addFileToIndex: @" empty.data " error: NULL ]);
// Check index status
GCDiff* diff = [repo diffRepositoryIndexWithHEAD: nil options: 0 maxInterHunkLines: 0 maxContextLines: 0 error: NULL ];
assert (diff.deltas.count == 1 );
NSLog ( @" %@ " , diff);
// Create a commit
GCCommit* newCommit = [repo createCommitFromHEADWithMessage: @" Added file " error: NULL ];
assert (newCommit);
NSLog ( @" %@ " , newCommit);
// Restore repo to saved snapshot before topic branch and commit were created
BOOL success = [repo restoreSnapshot: snapshot withOptions: kGCSnapshotOption_IncludeAll reflogMessage: @" Rolled back " didUpdateReferences: NULL error: NULL ];
assert (success);
// Make sure topic branch is gone
assert ([repo findLocalBranchWithName: @" temp " error: NULL ] == nil );
// Update workdir and index to match HEAD
assert ([repo resetToHEAD: kGCResetMode_Hard error: NULL ]);
GitDown is a very basic app that prompts the user for a repo and displays an interactive and live-updating list of its stashes (all with ~20 lines of code in -[AppDelegate applicationDidFinishLaunching:]
):
gitupkitを通じて、この基本的なアプリは、無料の無制限の元に戻す/やり直し、統一された並べ替え、テキストの選択とコピー、キーボードショートカットなども取得します...
このソースコードは、他のGitupkitビューコントローラーを使用したり、カスタマイズされたコントローラーを構築する方法を示しています。
GitDiff demonstrates how to create a view controller that displays a live updating diff between HEAD
and the workdir à la git diff HEAD
:
Gityは、Gitupkitを使用して構築されたGitxクローンで、200行未満のコードを使用しています。
IGITは、Gitupkitを使用してGitHub Repoをクローンしてコミットを実行するテストiOSアプリです。
Convributing.mdを参照してください。
また、Gitupが存在することはなかったでしょう。
Gitupは著作権2015-2018 Pierre-Olivier Latourであり、GPL V3ライセンスで入手可能です。詳細については、プロジェクトのライセンスファイルを参照してください。
IMPORTANT: GitUp includes some other open-source projects and such projects remain under their own license.