GitUp README

The project's README from github.com/git-up/GitUp. As one markdown file: README.md.

GitUp GitUpKit Tests

GitUp

Work quickly, safely, and without headaches. The Git interface you've been missing all your life has finally arrived.

Git recently celebrated its 10 years anniversary, but most engineers are still confused by its intricacy (3 of the top 5 questions of all time on Stack Overflow are Git related). Since Git turns even simple actions into mystifying commands (“git add” to stage versus “git reset HEAD” to unstage anyone?), it’s no surprise users waste time, get frustrated, distract the rest of their team for help, or worse, screw up their repo!

GitUp is a bet to invent a new Git interaction model that lets engineers of all levels work quickly, safely, and without headaches. It's unlike any other Git client out there from the way it’s built (it interacts directly with the Git database on disk), to the way it works (you manipulate the repository graph instead of manipulating commits).

With GitUp, you get a truly efficient Git client for Mac:

In addition, GitUp’s core and main UI elements are available as an open-source framework, GitUpKit. You can use it to build your very own Git GUI! GitUpKit has already enabled the creation of some unique apps:

GitUp was created by @swisspol in late 2014 as a bet to reinvent the way developers interact with Git. After several months of work, it was made available in pre-release early 2015 and reached the top of Hacker News along with being featured by Product Hunt and Daring Fireball. 30,000 lines of code later, GitUp reached 1.0 mid-August 2015 and was released open source as a gift to the developer community.

Getting Started

Download:

Read the docs and use GitHub Issues for support & feedback.

Releases notes are available at https://github.com/git-up/GitUp/releases. Builds tagged with a v (e.g. v1.2.3) are released on the "Stable" channel, while builds tagged with a b (e.g. b1234) are only released on the "Continuous" channel. You can change the update channel used by GitUp in the app preferences.

Build

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. Simply delete the "Code Signing Identity" build setting of the "Application" target to work around the issue:

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]

For a more detailed description of this, you can have a look at the comments at the end of the file "Xcode-Configurations/Base.xcconfig".

GitUpKit

GitUp is built as a thin layer on top of a reusable generic Git toolkit called "GitUpKit". This means that you can use that same GitUpKit framework to build your very own Git UI!

GitUpKit has a very different goal than ObjectiveGit. Instead of offering extensive raw bindings to libgit2, GitUpKit only uses a minimal subset of libgit2 and reimplements everything else on top of it (it has its own "rebase engine" for instance). This allows it to expose a very tight and consistent API, that completely follows Obj-C conventions and hides away the libgit2 complexity and sometimes inconsistencies. GitUpKit adds on top of that a number of exclusive and powerful features, from undo/redo and Time Machine like snapshots, to entire drop-in UI components.

Architecture

The GitUpKit source code is organized as 2 independent layers communicating only through the use of public APIs:

Base Layer (depends on Foundation only and is compatible with OS X and iOS)

UI Layer (depends on AppKit and is compatible with OS X only)

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. Be aware that this overhead can significantly affect performance.

GitUpKit API

Using the GitUpKit API should be pretty straightforward since it is organized by functionality (e.g. repository, branches, commits, interface components, etc...) and a best effort has been made to name functions clearly.

Regarding the "Core" APIs, the best way to learn them is to peruse the associated unit tests - for instance see the branch tests for the branch API.

Here is some sample code to get you started (error handling is left as an exercise to the reader):

Opening and browsing a repository:

// 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);

Modifying a repository:

// 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]);

Complete Example #1: GitDown

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:]):

Through GitUpKit, this basic app also gets for free unlimited undo/redo, unified and side-by-side diffs, text selection and copy, keyboard shortcuts, etc...

This source code also demonstrates how to use some other GitUpKit view controllers as well as building a customized one.

Complete Example #2: GitDiff

GitDiff demonstrates how to create a view controller that displays a live updating diff between HEAD and the workdir à la git diff HEAD:

Complete Example #3: GitY

GitY is a GitX clone built using GitUpKit and less than 200 lines of code:

Complete Example #4: iGit

iGit is a test iOS app that simply uses GitUpKit to clone a GitHub repo and perform a commit.

Contributing

See CONTRIBUTING.md.

Credits

Also a big thanks to the fine libgit2 contributors without whom GitUp would have never existed!

License

GitUp is copyright 2015-2018 Pierre-Olivier Latour and available under GPL v3 license. See the LICENSE file in the project for more information.

IMPORTANT: GitUp includes some other open-source projects and such projects remain under their own license.

GitUp (git-up/GitUp)

Searching Database…

12.1K ·GitHub
Что это такое?GitUp — нативный Git-клиент для Mac, который по-новому организует работу с Git: вместо того чтобы запоминать команды, вы работаете с живым интерактивным графом вашего репозитория.
Это GUI-приложение или на его основе можно создать собственный клиент?Это самостоятельное настольное приложение, но его ядро и интерфейс также доступны как открытый фреймворк GitUpKit, на основе которого можно создать собственный графический интерфейс для Git.
Как установить GitUp?Скачайте последнюю версию с GitHub или установите через Homebrew командой 'brew install gitup-app' (неофициально).
Есть ли подводные камни при самостоятельной сборке?Если у вас нет платного аккаунта Apple Developer, сборка завершится ошибкой при подписи кода, если вы не удалите настройку сборки 'Code Signing Identity' для цели Application.
Работает ли это на Mac с процессорами Intel, или только на Apple Silicon?GitUp — приложение для macOS (а базовый слой GitUpKit также совместим с iOS), и в README не упоминается никаких ограничений по архитектуре процессора.
Чем GitUp отличается от Git CLI или других графических клиентов?Он напрямую работает с базой данных Git на диске и позволяет манипулировать самим графом репозитория, с неограниченной отменой и повтором действий (даже для rebase и merge), снимками в стиле Time Machine для отката, визуальным инструментом разделения коммитов, единым браузером reflog и мгновенным поиском по диффам — это функции, которых сам Git не предлагает.
Для чего конкретно используется GitUpKit?GitUpKit — это переиспользуемый набор инструментов для Git, который оборачивает минимальный поднабор libgit2 собственным движком rebase и предоставляет понятный API на Objective-C, а также готовые UI-компоненты, так что другие приложения (например, Retcon, GitY, GitDown) могут строиться на его основе.
Зачем был создан GitUp?Его автор считал, что сложность командной строки Git (отражением чего стало то, что Git доминирует в топе вопросов на Stack Overflow) можно решить с помощью лучшей модели взаимодействия, поэтому GitUp создавался, чтобы инженеры могли быстро и безопасно работать с Git, не запоминая загадочные команды.
Ведётся ли активная разработка?В README упоминаются релизы примерно до 2018 года и различаются канал 'Stable' (с тегами вида vX.Y.Z) и канал 'Continuous' (с тегами вида bNNNN), который настраивается в параметрах приложения, но текущая частота выпусков не указана.
Creator
git-up
Size
66.5 MB
Stars
12.1K
Age
11y
Commits · 90 Days