Skip to content

Commit e39e803

Browse files
authored
Merge pull request #114 from nodenv/jasonkarns-patch-1
Document git tag configuration for upstream rbenv repos
2 parents 8a7cb7d + fae79e5 commit e39e803

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

‎docs/CONTRIBUTING.md‎

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,59 @@ https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contr
66

77
# Contributing
88

9+
## Rbenv Tags Git Configuration
10+
11+
Many repositories in the nodenv organization are forks from the rbenv
12+
ecosystem. To support pulling changes from the upstream rbenv repository into
13+
nodenv, it is necessary to add rbenv as a Git remote. However, this adds some
14+
complication because (by default), Git tags for nodenv and rbenv will collide.
15+
(ie, rbenv's `v1.0.0` tag conflicts with nodenv's `v1.0.0`) Additionally,
16+
having rbenv's tags exist locally introduces complications to the release
17+
process: `git push --follow-tags` would push rbenv's tags to nodenv's `origin`
18+
remote.
19+
20+
The following special Git configuration avoids these and other headaches while
21+
still allowing `origin` to be pushed using `--tags` or `--follow-tags`
22+
options—without the risk of pushing rbenv's tags into nodenv's tagspace. The
23+
configuration assumes nodenv's remote is `origin`, and rbenv's remote is
24+
`rbenv`.
25+
26+
1. Configure rbenv to not fetch tags by default:
27+
28+
```console
29+
git config remote.rbenv.tagOpt --no-tags
30+
```
31+
32+
2. Fetch rbenv's tags to their own refspec namespace (`rbtags`, in this case):
33+
34+
```console
35+
git config --add remote.rbenv.fetch '+refs/tags/*:refs/rbtags/*'
36+
```
37+
38+
> [!WARNING]
39+
> The `--tags` option to `fetch` et. al. will override this setting.
40+
41+
Resulting snippet in `.git/config`:
42+
43+
```gitconfig
44+
[remote "origin"]
45+
url = git@github.com:nodenv/nodenv.git
46+
fetch = +refs/heads/*:refs/remotes/origin/*
47+
[remote "rbenv"]
48+
url = git@github.com:rbenv/rbenv.git
49+
fetch = +refs/heads/*:refs/remotes/rbenv/*
50+
fetch = +refs/tags/*:refs/rbtags/*
51+
tagopt = --no-tags
52+
```
53+
54+
To reference rbenv's tags, use the fully qualified refspec: `refs/rbtags/vX.Y.Z`
55+
56+
```console
57+
git show refs/rbtags/v1.1.2
58+
git checkout refs/rbtags/v1.1.2
59+
git merge refs/rbtags/v1.1.2
60+
```
61+
962
## Releasing
1063

1164
From a clean working copy, run `npm version major|minor|patch|VERSION`.

0 commit comments

Comments
 (0)