https://github.com/sabmeua/git-accept
Easy to merge git conflicts to accept both changes.
https://github.com/sabmeua/git-accept
git git-extension
Last synced: 3 months ago
JSON representation
Easy to merge git conflicts to accept both changes.
- Host: GitHub
- URL: https://github.com/sabmeua/git-accept
- Owner: sabmeua
- Created: 2019-12-04T05:21:10.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-12-09T07:48:54.000Z (almost 6 years ago)
- Last Synced: 2025-06-24T07:37:24.400Z (4 months ago)
- Topics: git, git-extension
- Language: Shell
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# git-accept
Easy to merge git conflicts to accept both changes.
[](https://circleci.com/gh/sabmeua/git-accept)
## What's this
When git merge/rebase shows you that it couldn't resolve all of your conflicts automatically,
you will try to solve using `git checkout` with option `--theirs` , `--ours` or manually edit with `git mergetool`.However, sometimes you may want to simply adopt both changes. In that case if using an editor like Atom or VSCode,
it can choose the menu to solve it but there isn't in git cli. This is a simple git extension subcommand that does just that.### Example
If there is a conflict as follows.
```sh
$ git diff file
diff --cc file
index b414108,9f9a0f9..0000000
--- a/file
+++ b/file
@@@ -1,6 -1,6 +1,11 @@@
1
2
++<<<<<<< HEAD
+3
+4
++=======
+ 三
+ 四
++>>>>>>> develop
5
6
```It can merge like this with `git accept`.
```sh
$ git accept theirs file
$ cat file
1
2
三
四
5
6$ git accept ours file
$ cat file
1
2
3
4
5
6$ git accept theirs-then-ours file
$ cat file
1
2
三
四
3
4
5
6$ git accept ours-then-theirs file
$ cat file
1
2
3
4
三
四
5
6
```## Usage
```sh
git accept
```### Available merge plans
* `ours`, `2` : Accept incoming changes. alias of `git checkout --ours`, `git checkout -2`.
* `theirs`, `3` : Accept current changes. alias of `git checkout --theirs`, `git checkout -3`.
* `ours-then-theirs`, `23` : Accept both current and incoming changes in the order of `ours`, `theirs`.
* `theirs-then-ours`, `32` : Accept both current and incoming changes in the order of `theirs`, `ours`.
* `cancel` : Discard local changes and revert to conflict. alias of `git checkout -m`.## Instration
Place `git-accept` in your PATH and add `+x` permission, and git will make it available as a `accept` subcommand.
If you no longer need it, simply remove the file.