Skip to content

Commit 812a7f4

Browse files
authored
update examples in git-version-control section (#153)
1 parent 1f536f5 commit 812a7f4

File tree

1 file changed

+34
-12
lines changed

1 file changed

+34
-12
lines changed

git-version-control.Rmd

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ git branch and in the current release branch (e.g., `RELEASE_3_14`).
832832
Bump the version of the package by editing the `Version` field in the
833833
`DESCRIPTION` and commit the change __in a separate commit__. This allows to
834834
only `cherry-pick` the bug correction and avoid version number conflicts with
835-
the Bioconductor branches when/if the bug fixes are ported to release.
835+
the Bioconductor branches when/if the bug fixes are ported to release.
836836
837837
## after version bump
838838
git add DESCRIPTION
@@ -1073,13 +1073,13 @@ You also must remove them from the git tree (the repository history), or else
10731073
your repository will remain large.
10741074
10751075
There are a few ways to remove large files from a git history. Here, we'll
1076-
outline two options: 1) `git filter-repo`, and 2) the BFG repo cleaner.
1076+
outline two options: 1) `git filter-repo`, and 2) the BFG repo cleaner.
10771077
These steps should be run on your local copy and (if necessary) pushed to your
10781078
own github repository.
10791079
10801080
#### Removing Large Files from History with filter-repo
10811081
1082-
As of 2023, the recommended way is to first locate any large files, and
1082+
As of 2023, the recommended way is to first locate any large files, and
10831083
then remove them with `git filter-repo`.
10841084
10851085
1. Identify large files using [this git rev-list script](
@@ -1099,38 +1099,60 @@ history, in order of file size. Use this to identify the names of files to remov
10991099
11001100
2. Remove them with [filter-repo](https://github.com/newren/git-filter-repo).
11011101
1102-
This is a separate tool that you'll have to install
1102+
This is a separate tool that you'll have to install
11031103
(with *e.g.* `pip3 install git-filter-repo`). Then, you can rewrite your repository
1104-
history to remove files like this, where `<file-glob>` identifies your files:
1104+
history to remove files. Here are a few examples:
1105+
1106+
* To remove a specific file:
1107+
1108+
```
1109+
git filter-repo --path path/to/your/large_file --invert-paths
1110+
```
1111+
1112+
* To remove a folder:
11051113
11061114
```
1107-
git filter-repo --path-glob '<file-glob>' --invert-paths
1115+
git filter-repo --path path/to/your/folder/ --invert-paths
11081116
```
11091117
1110-
For example, to remove all `.RData` files, you could use:
1118+
* To remove all files of a certain type (e.g. `.RData`):
11111119
11121120
```
11131121
git filter-repo --path-glob '*.RData' --invert-paths
11141122
```
11151123
1116-
This command may reset your remotes. Check with `git remote` and
1124+
* To remove all files larger than a certain size (e.g. 50MB):
1125+
1126+
```
1127+
git filter-repo --strip-blobs-bigger-than 50M
1128+
```
1129+
1130+
3. Final steps.
1131+
1132+
This command may reset your remotes. Check with `git remote -v` and
11171133
if needed, you can add remotes back in using something like this:
11181134
11191135
```
11201136
git remote add origin [email protected]:<username>/<repo_name>
11211137
git push --set-upstream origin devel --force
11221138
```
11231139
1124-
Finally, we have to push with `--mirror` to reset the remote.
1140+
Finally, we have to push with `--mirror` to reset the remote. This will update
1141+
your remote repository on GitHub.
11251142
11261143
```
11271144
git push --force --mirror
11281145
```
11291146
1130-
Now, just notify everyone that they'll have to re-clone the new repository, since
1147+
Now, just notify everyone that they'll have to re-clone the new repository, since
11311148
history has been rewritten, so existing clones will no longer be compatible
11321149
with this repo.
11331150
1151+
If you need to update the Bioconductor repository, you will need to contact the
1152+
Bioconductor Core Team to sync your repository with the version on Bioconductor,
1153+
as force pushes which alter the git timeline are not possible for maintainers on
1154+
the Bioconductor git server.
1155+
11341156
#### Removing Large Files from History with BFG repo cleaner
11351157
11361158
Another option is to use BFG. The steps below assume `origin` is a user-maintained github
@@ -1466,6 +1488,6 @@ please send an email to <[email protected]>.
14661488
14671489
[resolve duplicate commits][]
14681490
1469-
[Pull requests][]
1491+
[Pull requests][]
14701492
1471-
[Open github issues][Open github issue]
1493+
[Open github issues][Open github issue]

0 commit comments

Comments
 (0)