Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidied up the installation instructions #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 25 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A tool for merging Xcode project files in git

Version: 0.6 - 2nd Oct 2014
Version: 0.9 - 23rd March 2015
Status: Alpha

* Follow us on twitter: https://twitter.com/mergepbx
Expand Down Expand Up @@ -30,70 +30,64 @@ Note also, that this script can't solve conflicts, that are really conflicts. Fo

## Usage ##

To use this script, you have to configure it as a merge driver for you project file. To do this, you have to take the following steps:
To use this script, you can either install using [Homebrew](http://brew.sh), or if you prefer build it yourself. To install with Homebrew simply run:

### Building ###
```sh
brew install mergepbx
```

Execute the following command in the directory of the cloned project:
To build yourself clone the repository to you maching and then execute the following command in the root of the project:

```
./build.py
```

That should build the mergepbx executable that you can use. It is a specially crafted zip file that contains all needed python files and can directly be executed on the commandline
That should build the `mergepbx` executable that you can use. You then need to place the executable into a location on your command line path (`echo $PATH` to find where these are on your machine).

### Using mergepbx as merge tool ###
You then need to follow the steps to setup Mergepbx as either a [merge tool](http://git-scm.com/docs/git-mergetool) or a merge driver. The merge tool will need to be run by you on the command line each time you want to resolve conflicts in the project file, whereas the merge driver can be set up to automatically resolve conflicts when they are found.

You can add mergepbx as a merge tool, so you can use it to manually start merging the project file with `git mergetool --tool=mergepbx PROJECT.pbxproj`.
### Using mergepbx as a merge driver ###

#### Add mergepbx as a merge tool ####
You can also configure git to always use `mergepbx` automatically, when it encounters a conflict in a project file

Open `~/.gitconfig` (create if it does not exist) and add the following lines to it:

```
#driver for merging Xcode project files
[mergetool "mergepbx"]
cmd = mergepbx "$BASE" "$LOCAL" "$REMOTE" -o "$MERGED"
[merge "mergepbx"]
name = Xcode project files merger
driver = mergepbx %O %A %B
```

#### Merging project files ####

After you have encountered a failed automatic merge, you can now use the following command to start the automatic merge with `mergepbx`:
In your repository root directory, open the file `.gitattributes` (create if it does not exist). Add the following lines to it:

```
git mergetool --tool=mergepbx PROJECT.pbxproj
*.pbxproj merge=mergepbx
```

Afterwards, the project file should be merged and marked as resolved.
You will need to repeat the `.gitattributes` step for each of your git repositories that you want to enable Mergepbx in.

### Using mergepbx as a merge driver ###
If you merge branches with git now, git will automatically use mergepbx for `*.pbxproj` files. You don't have to do anything special, simply merge your branches as before.

You can also configure git to always use `mergepbx` automatically, when it encounters a conflict in a project file
Note that this script is not really fast, I didn't optimize it for speed and especially the plist parser is not very fast.

### Using mergepbx as merge tool ###

Open `~/.gitconfig` (create if it does not exist) and add the following lines to it:

```
#driver for merging Xcode project files
[merge "mergepbx"]
name = Xcode project files merger
driver = mergepbx %O %A %B
[mergetool "mergepbx"]
cmd = mergepbx "$BASE" "$LOCAL" "$REMOTE" -o "$MERGED"
```

Replace mergepbx with the path to the file you downloaded (You might want to add that file to your $PATH)

#### Configure your repository to use the driver ####

In your repository root directory, open the file `.gitattributes` (create if it does not exist). Add the following lines to it:
After you have encountered a failed automatic merge, you can now use the following command to start the automatic merge with `mergepbx`:

```
*.pbxproj merge=mergepbx
git mergetool --tool=mergepbx PROJECT.pbxproj
```

#### Merging project files ####

If you merge branches with git now, git will automatically use mergepbx for .pbxproj files. You don't have to do anything special, simply merge your branches as before.

Note that this script is not really fast, I didn't optimize it for speed and especially the plist parser is not very fast.
Afterwards, the project file should be merged and marked as resolved.

## Alternatives ##

Expand Down