webmat / git_remote_branch

A tool to simplify working with remote branches

This URL has Read+Write access

git_remote_branch / README
100644 119 lines (71 sloc) 3.279 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
==== Why git_remote_branch? ====
 
The basic idea for git_remote_branch is to trivialize the interaction with
remote branches in simple situations.
 
For now git_remote_branch assumes that the local and remote branches have the
same name. Multiple origins are supported.
 
Another goal of git_remote_branch is to help teach the real underlying git
commands. Each operation done on your behalf is displayed at the console.
 
 
 
==== Installation ====
 
sudo gem install webmat-git_remote_branch --source=http://gems.github.com
 
Note: don't add gems.github.com as a permanent source for your gems. Check out
http://gems.github.com for more information on the matter. If you've included
it already and find yourself in trouble, check out
http://chalain.livejournal.com/71260.html.
 
 
 
==== Usage ====
 
Notes:
- parts between brackets are optional
- When 'origin_server' is not specified, the name 'origin' is assumed.
 
Available commands (with aliases):
 
== Help ==
 
$ grb [-h] #=> Displays help
 
== create (alias: new) ==
Create a new local branch as well as a corresponding remote branch from the
branch you are currently on.
Automatically track the new remote branch (useful for pulling and merging).
Switch to the new branch.
 
$ grb create branch_name [origin_server]
 
 
== delete (aliases: destroy, kill, remove) ==
Delete the remote branch then delete the local branch.
The local branch is not deleted if there are pending changes.
 
$ grb delete branch_name [origin_server]
 
 
== track (aliases: follow grab fetch) ==
Track an existing remote branch locally.
 
$ grb track branch_name [origin_server]
 
 
== rename (aliases: rn, mv, move) ==
Rename the remote branch by copying and deleting the old name.
Checkout a new local tracking branch with the new name and delete the branch
with the old name.
branch_name is the new name, the old name is always the current branch's
 
$ grb rename branch_name [origin_server]
 
 
== explain ==
 
All commands can be prepended by the word 'explain'. Instead of executing the
command, git_remote_branch will simply output the list of commands you need to
run to accomplish that goal.
Examples:
 
$ grb explain create
git_remote_branch version 0.2.2
 
List of operations to do to create a new remote branch and track it locally:
 
git push origin master:refs/heads/branch_to_create
git fetch origin
git branch --track branch_to_create origin/branch_to_create
git checkout branch_to_create
 
 
$ grb explain create my_branch github
git_remote_branch version 0.2.2
 
List of operations to do to create a new remote branch and track it locally:
 
git push github master:refs/heads/my_branch
git fetch github
git branch --track my_branch github/my_branch
git checkout my_branch
 
 
==== History ====
 
This script was originally created by Carl Mercier and made public on his blog
here:
 
No nonsense GIT, part 1: git-remote-branch
http://blog.carlmercier.com/2008/01/25/no-nonsense-git-part-1-git-remote-branch/
 
 
I'm using it as a starting point to make it even easier to interact with remote
repositories.
 
 
=== Contributors ===
 
- Mathieu Martin webmat@gmail.com
- Carl Mercier (Carl: want your email here?)
- Caio Chassot dev@caiochassot.com
 
 
=== Legalese ===
 
git_remote_branch is licensed under the MIT License. See the file COPYING for details.