Skip to content

Commit 843b958

Browse files
authored
Merge pull request #946 from tfendin/default_branch_logic
2 parents b772251 + 2d722c9 commit 843b958

File tree

5 files changed

+253
-240
lines changed

5 files changed

+253
-240
lines changed

Readme.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,12 @@ __GIT utilities__ -- repo summary, repl, changelog population, author commit per
2323
Interested in contributing? Awesome!
2424

2525
Please read [Contributing](CONTRIBUTING.md) before you make a PR, thanks!
26+
27+
## The change of the default branch
28+
29+
As of Git Extras 6.4 the assumed default branch name changed from `master` to `main`.
30+
This affects the Git Extras commands `git archive-file`, `git delete-merged-branches`, `git delta`, `git pull-request`, `git show-merged-branches`, `git show-unmerged-branches` and `git squash`.
31+
32+
To change the default branch name to `master`: change either the configuration `git-extras.default-branch` or `init.defaultBranch` to `master`, the former takes precedence.
33+
34+
For example, `git config git-extras.default-branch master`

helper/git-extra-utility

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ git_extra_mktemp() {
66
}
77

88
git_extra_default_branch() {
9-
local default_branch
10-
default_branch=$(git config --get git-extras.default-branch)
11-
if [ -z "$default_branch" ]; then
12-
echo "master"
9+
local extras_default_branch init_default_branch
10+
extras_default_branch=$(git config --get git-extras.default-branch)
11+
init_default_branch=$(git config --get init.defaultBranch)
12+
if [ -n "$extras_default_branch" ]; then
13+
echo "$extras_default_branch"
14+
elif [ -n "$init_default_branch" ]; then
15+
echo "$init_default_branch"
1316
else
14-
echo "$default_branch"
17+
echo "main"
1518
fi
1619
}

man/git-extras.1

Lines changed: 78 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -1,245 +1,171 @@
1-
.\" generated with Ronn/v0.7.3
2-
.\" http://github.com/rtomayko/ronn/tree/0.7.3
3-
.
4-
.TH "GIT\-EXTRAS" "1" "October 2020" "" "Git Extras"
5-
.
1+
.\" generated with Ronn-NG/v0.9.1
2+
.\" http://github.com/apjanke/ronn-ng/tree/0.9.1
3+
.TH "GIT\-EXTRAS" "1" "December 2021" "" "Git Extras"
64
.SH "NAME"
75
\fBgit\-extras\fR \- Awesome GIT utilities
8-
.
96
.SH "SYNOPSIS"
107
\fBgit\-extras\fR [\-v,\-\-version] [\-h,\-\-help] [update]
11-
.
128
.SH "OPTIONS"
139
\-v, \-\-version
14-
.
1510
.P
1611
Show git\-extras version number\.
17-
.
1812
.P
1913
\-h, \-\-help
20-
.
2114
.P
2215
Show this help\. This option can also be used for any of the extras commands\.
23-
.
2416
.P
2517
update
26-
.
2718
.P
2819
Self update\.
29-
.
3020
.SH "ENVIRONMENT AND CONFIGURATION VARIABLES"
3121
\fBgit config \-\-add git\-extras\.default\-branch $BRANCH\fR
32-
.
3322
.P
34-
Change the default branch to \fB$BRANCH\fR (defaut to \fBmaster\fR)\.
35-
.
23+
Change the default branch to \fB$BRANCH\fR\. If \fBgit\-extras\.default\-branch\fR isn\'t set, \fBinit\.defaultBranch\fR is used instead\. If none of them are set it defaults to \fBmain\fR\.
3624
.SH "COMMANDS"
37-
.
38-
.IP "\(bu" 4
25+
.IP "\[ci]" 4
26+
\fBgit\-abort(1)\fR Abort current git operation
27+
.IP "\[ci]" 4
3928
\fBgit\-alias(1)\fR Define, search and show aliases
40-
.
41-
.IP "\(bu" 4
29+
.IP "\[ci]" 4
4230
\fBgit\-archive\-file(1)\fR Export the current HEAD of the git repository to an archive
43-
.
44-
.IP "\(bu" 4
31+
.IP "\[ci]" 4
4532
\fBgit\-authors(1)\fR Generate authors report
46-
.
47-
.IP "\(bu" 4
33+
.IP "\[ci]" 4
4834
\fBgit\-browse(1)\fR \fIView the web page for the current repository\fR
49-
.
50-
.IP "\(bu" 4
35+
.IP "\[ci]" 4
5136
\fBgit\-brv(1)\fR List branches sorted by their last commit date
52-
.
53-
.IP "\(bu" 4
37+
.IP "\[ci]" 4
5438
\fBgit\-bulk(1)\fR Run git commands on multiple repositories
55-
.
56-
.IP "\(bu" 4
39+
.IP "\[ci]" 4
5740
\fBgit\-changelog(1)\fR Generate a changelog report
58-
.
59-
.IP "\(bu" 4
41+
.IP "\[ci]" 4
6042
\fBgit\-clear\-soft(1)\fR Soft clean up a repository
61-
.
62-
.IP "\(bu" 4
43+
.IP "\[ci]" 4
6344
\fBgit\-clear(1)\fR Rigorously clean up a repository
64-
.
65-
.IP "\(bu" 4
45+
.IP "\[ci]" 4
6646
\fBgit\-coauthor(1)\fR Add a co\-author to the last commit
67-
.
68-
.IP "\(bu" 4
47+
.IP "\[ci]" 4
6948
\fBgit\-commits\-since(1)\fR Show commit logs since some date
70-
.
71-
.IP "\(bu" 4
49+
.IP "\[ci]" 4
7250
\fBgit\-contrib(1)\fR Show user\'s contributions
73-
.
74-
.IP "\(bu" 4
51+
.IP "\[ci]" 4
7552
\fBgit\-count(1)\fR Show commit count
76-
.
77-
.IP "\(bu" 4
53+
.IP "\[ci]" 4
7854
\fBgit\-cp(1)\fR Copy a file keeping its history
79-
.
80-
.IP "\(bu" 4
55+
.IP "\[ci]" 4
8156
\fBgit\-create\-branch(1)\fR Create branches
82-
.
83-
.IP "\(bu" 4
57+
.IP "\[ci]" 4
8458
\fBgit\-delete\-branch(1)\fR Delete branches
85-
.
86-
.IP "\(bu" 4
59+
.IP "\[ci]" 4
8760
\fBgit\-delete\-merged\-branches(1)\fR Delete merged branches
88-
.
89-
.IP "\(bu" 4
61+
.IP "\[ci]" 4
62+
\fBgit\-delete\-squashed\-branches(1)\fR Delete branches that were squashed
63+
.IP "\[ci]" 4
9064
\fBgit\-delete\-submodule(1)\fR Delete submodules
91-
.
92-
.IP "\(bu" 4
65+
.IP "\[ci]" 4
9366
\fBgit\-delete\-tag(1)\fR Delete tags
94-
.
95-
.IP "\(bu" 4
67+
.IP "\[ci]" 4
9668
\fBgit\-delta(1)\fR Lists changed files
97-
.
98-
.IP "\(bu" 4
69+
.IP "\[ci]" 4
9970
\fBgit\-effort(1)\fR Show effort statistics on file(s)
100-
.
101-
.IP "\(bu" 4
71+
.IP "\[ci]" 4
10272
\fBgit\-feature(1)\fR Create/Merge feature branch
103-
.
104-
.IP "\(bu" 4
73+
.IP "\[ci]" 4
10574
\fBgit\-force\-clone(1)\fR overwrite local repositories with clone
106-
.
107-
.IP "\(bu" 4
75+
.IP "\[ci]" 4
10876
\fBgit\-fork(1)\fR Fork a repo on github
109-
.
110-
.IP "\(bu" 4
77+
.IP "\[ci]" 4
11178
\fBgit\-fresh\-branch(1)\fR Create fresh branches
112-
.
113-
.IP "\(bu" 4
79+
.IP "\[ci]" 4
11480
\fBgit\-gh\-pages(1)\fR Create the GitHub Pages branch
115-
.
116-
.IP "\(bu" 4
81+
.IP "\[ci]" 4
11782
\fBgit\-graft(1)\fR Merge and destroy a given branch
118-
.
119-
.IP "\(bu" 4
83+
.IP "\[ci]" 4
12084
\fBgit\-guilt(1)\fR calculate change between two revisions
121-
.
122-
.IP "\(bu" 4
85+
.IP "\[ci]" 4
12386
\fBgit\-ignore\-io(1)\fR Get sample gitignore file
124-
.
125-
.IP "\(bu" 4
87+
.IP "\[ci]" 4
12688
\fBgit\-ignore(1)\fR Add \.gitignore patterns
127-
.
128-
.IP "\(bu" 4
89+
.IP "\[ci]" 4
12990
\fBgit\-info(1)\fR Returns information on current repository
130-
.
131-
.IP "\(bu" 4
91+
.IP "\[ci]" 4
13292
\fBgit\-local\-commits(1)\fR List local commits
133-
.
134-
.IP "\(bu" 4
93+
.IP "\[ci]" 4
13594
\fBgit\-lock(1)\fR Lock a file excluded from version control
136-
.
137-
.IP "\(bu" 4
95+
.IP "\[ci]" 4
13896
\fBgit\-locked(1)\fR ls files that have been locked
139-
.
140-
.IP "\(bu" 4
97+
.IP "\[ci]" 4
98+
\fBgit\-magic(1)\fR Automate add/commit/push routines
99+
.IP "\[ci]" 4
141100
\fBgit\-merge\-into(1)\fR Merge one branch into another
142-
.
143-
.IP "\(bu" 4
101+
.IP "\[ci]" 4
144102
\fBgit\-merge\-repo(1)\fR Merge two repo histories
145-
.
146-
.IP "\(bu" 4
103+
.IP "\[ci]" 4
147104
\fBgit\-missing(1)\fR Show commits missing from another branch
148-
.
149-
.IP "\(bu" 4
105+
.IP "\[ci]" 4
150106
\fBgit\-mr(1)\fR Checks out a merge request locally
151-
.
152-
.IP "\(bu" 4
107+
.IP "\[ci]" 4
153108
\fBgit\-obliterate(1)\fR rewrite past commits to remove some files
154-
.
155-
.IP "\(bu" 4
109+
.IP "\[ci]" 4
156110
\fBgit\-paste(1)\fR Send patches to pastebin for chat conversations
157-
.
158-
.IP "\(bu" 4
111+
.IP "\[ci]" 4
159112
\fBgit\-pr(1)\fR Checks out a pull request locally
160-
.
161-
.IP "\(bu" 4
113+
.IP "\[ci]" 4
162114
\fBgit\-psykorebase(1)\fR Rebase a branch with a merge commit
163-
.
164-
.IP "\(bu" 4
115+
.IP "\[ci]" 4
165116
\fBgit\-pull\-request(1)\fR Create pull request for GitHub project
166-
.
167-
.IP "\(bu" 4
117+
.IP "\[ci]" 4
168118
\fBgit\-reauthor(1)\fR Rewrite history to change author\'s identity
169-
.
170-
.IP "\(bu" 4
119+
.IP "\[ci]" 4
171120
\fBgit\-rebase\-patch(1)\fR Rebases a patch
172-
.
173-
.IP "\(bu" 4
121+
.IP "\[ci]" 4
174122
\fBgit\-release(1)\fR Commit, tag and push changes to the repository
175-
.
176-
.IP "\(bu" 4
123+
.IP "\[ci]" 4
177124
\fBgit\-rename\-branch(1)\fR rename local branch and push to remote
178-
.
179-
.IP "\(bu" 4
125+
.IP "\[ci]" 4
180126
\fBgit\-rename\-remote(1)\fR Rename a remote
181-
.
182-
.IP "\(bu" 4
127+
.IP "\[ci]" 4
183128
\fBgit\-rename\-tag(1)\fR Rename a tag
184-
.
185-
.IP "\(bu" 4
129+
.IP "\[ci]" 4
186130
\fBgit\-repl(1)\fR git read\-eval\-print\-loop
187-
.
188-
.IP "\(bu" 4
131+
.IP "\[ci]" 4
189132
\fBgit\-reset\-file(1)\fR Reset one file
190-
.
191-
.IP "\(bu" 4
133+
.IP "\[ci]" 4
192134
\fBgit\-root(1)\fR show path of root
193-
.
194-
.IP "\(bu" 4
135+
.IP "\[ci]" 4
195136
\fBgit\-scp(1)\fR Copy files to SSH compatible \fBgit\-remote\fR
196-
.
197-
.IP "\(bu" 4
137+
.IP "\[ci]" 4
198138
\fBgit\-sed(1)\fR replace patterns in git\-controlled files
199-
.
200-
.IP "\(bu" 4
139+
.IP "\[ci]" 4
201140
\fBgit\-setup(1)\fR Set up a git repository
202-
.
203-
.IP "\(bu" 4
141+
.IP "\[ci]" 4
204142
\fBgit\-show\-merged\-branches(1)\fR Show merged branches
205-
.
206-
.IP "\(bu" 4
143+
.IP "\[ci]" 4
207144
\fBgit\-show\-tree(1)\fR show branch tree of commit history
208-
.
209-
.IP "\(bu" 4
145+
.IP "\[ci]" 4
210146
\fBgit\-show\-unmerged\-branches(1)\fR Show unmerged branches
211-
.
212-
.IP "\(bu" 4
147+
.IP "\[ci]" 4
213148
\fBgit\-squash(1)\fR squash N last changes up to a ref\'ed commit
214-
.
215-
.IP "\(bu" 4
149+
.IP "\[ci]" 4
216150
\fBgit\-stamp(1)\fR Stamp the last commit message
217-
.
218-
.IP "\(bu" 4
151+
.IP "\[ci]" 4
219152
\fBgit\-standup(1)\fR Recall the commit history
220-
.
221-
.IP "\(bu" 4
153+
.IP "\[ci]" 4
222154
\fBgit\-summary(1)\fR Show repository summary
223-
.
224-
.IP "\(bu" 4
155+
.IP "\[ci]" 4
225156
\fBgit\-sync(1)\fR Sync local branch with remote branch
226-
.
227-
.IP "\(bu" 4
157+
.IP "\[ci]" 4
228158
\fBgit\-touch(1)\fR Touch and add file to the index
229-
.
230-
.IP "\(bu" 4
159+
.IP "\[ci]" 4
231160
\fBgit\-undo(1)\fR Remove latest commits
232-
.
233-
.IP "\(bu" 4
161+
.IP "\[ci]" 4
234162
\fBgit\-unlock(1)\fR Unlock a file excluded from version control
235-
.
163+
.IP "\[ci]" 4
164+
\fBgit\-utimes(1)\fR Change files modification time to their last commit date
236165
.IP "" 0
237-
.
238166
.SH "AUTHOR"
239167
Written by Tj Holowaychuk <\fItj@vision\-media\.ca\fR>
240-
.
241168
.SH "REPORTING BUGS"
242169
<\fIhttps://github\.com/tj/git\-extras/issues\fR>
243-
.
244170
.SH "SEE ALSO"
245171
<\fIhttps://github\.com/tj/git\-extras\fR>

0 commit comments

Comments
 (0)