Chromium Code Reviews| Index: git_squash_branch.py |
| diff --git a/git_squash_branch.py b/git_squash_branch.py |
| new file mode 100755 |
| index 0000000000000000000000000000000000000000..fbf73369fadf0c01b551af7c4ffdb8c224573f6f |
| --- /dev/null |
| +++ b/git_squash_branch.py |
| @@ -0,0 +1,26 @@ |
| +#!/usr/bin/env python |
| +# Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| +import sys |
| + |
| +from git_common import current_branch, upstream, get_or_create_merge_base_tag |
| +from git_common import run, clean_refs |
| + |
| + |
| +def squash(): |
| + branch = current_branch() |
| + parent = upstream(branch) |
| + merge_base = get_or_create_merge_base_tag(branch, parent) |
| + run('reset', '--soft', merge_base) |
| + run('commit', '-a', '-C', 'HEAD@{1}') |
| + |
| + |
| +def main(): |
|
Ryan Tseng
2014/02/28 21:22:05
Add usage and --help
|
| + squash() |
| + clean_refs() |
| + return 0 |
| + |
| +if __name__ == '__main__': |
| + sys.exit(squash()) |
| + |