Skip to content

Commit 85a7b98

Browse files
authored
Improve README: grammar, rearrange sections (#128)
1 parent bdb801f commit 85a7b98

File tree

1 file changed

+46
-43
lines changed

1 file changed

+46
-43
lines changed

README.md

Lines changed: 46 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,34 @@
22

33
[![Go Report Card](https://goreportcard.com/badge/github.com/alexandear/import-gitlab-commits)](https://goreportcard.com/report/github.com/alexandear/import-gitlab-commits)
44

5-
The tool to import commits from private GitLab to separate repo. Can be used to show your programming activity for another company in GitHub.
5+
This tool imports commits from a private GitLab repository to a separate repository.
6+
It can be used to showcase your programming activity for another company on GitHub.
67

7-
Check out this informative blog post for a practical use case on how to import GitLab commits [here](https://alexandear.github.io/posts/2023-03-08-import-gitlab-commits/).
8+
Check out this informative blog post for a practical use case on how to import GitLab commits
9+
[here](https://alexandear.github.io/posts/2023-03-08-import-gitlab-commits/).
10+
11+
## Why It's Useful
12+
13+
Contributions before running `import-gitlab-commits`:
14+
15+
<picture>
16+
<source media="(prefers-color-scheme: dark)" srcset="screenshots/contribs_before_dark.png">
17+
<source media="(prefers-color-scheme: light)" srcset="screenshots/contribs_before_light.png">
18+
<img alt="Screenshot of GitHub contributions graph before running import-gitlab-commits" src="screenshots/contribs_before_dark.png" width="1000">
19+
</picture>
20+
21+
After:
22+
23+
<picture>
24+
<source media="(prefers-color-scheme: dark)" srcset="screenshots/contribs_after_dark.png">
25+
<source media="(prefers-color-scheme: light)" srcset="screenshots/contribs_after_light.png">
26+
<img alt="Screenshot of GitHub contributions graph after running import-gitlab-commits with a lot of activity" src="screenshots/contribs_after_dark.png" width="1000">
27+
</picture>
828

929
## Getting Started
1030

1131
1. Download and install [Go](https://go.dev/dl/).
12-
2. Install the program by running the command in a shell:
32+
2. Install the program by running the following command in a shell:
1333

1434
```shell
1535
go install github.com/alexandear/import-gitlab-commits@latest
@@ -26,57 +46,40 @@ Check out this informative blog post for a practical use case on how to import G
2646
$(go env GOPATH)/bin/import-gitlab-commits
2747
```
2848

29-
where
49+
Where:
3050

31-
- `GITLAB_BASE_URL` is a GitLab [instance URL](https://stackoverflow.com/questions/58236175/what-is-a-gitlab-instance-url-and-how-can-i-get-it), e.g. `https://gitlab.com`, `https://gitlab.gnome.org` or any GitLab server;
32-
- `GITLAB_TOKEN` is a personal [access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token);
33-
- `COMMITTER_NAME` is your GitHub name with surname, e.g. `John Doe` (can be passed to `git config user.name`);
34-
- `COMMITTER_EMAIL` is your GitHub email, e.g. `[email protected]` (valid for `git config user.email`);
35-
- `$(go env GOPATH)/bin/` is the path where `import-gitlab-commits` installed.
36-
37-
## Example
38-
39-
Contributions before running `import-gitlab-commits`:
40-
41-
<picture>
42-
<source media="(prefers-color-scheme: dark)" srcset="screenshots/contribs_before_dark.png">
43-
<source media="(prefers-color-scheme: light)" srcset="screenshots/contribs_before_light.png">
44-
<img alt="Screenshot of GitHub contributions graph before running import-gitlab-commits" src="screenshots/contribs_before_dark.png" width="1000">
45-
</picture>
46-
47-
After:
48-
49-
<picture>
50-
<source media="(prefers-color-scheme: dark)" srcset="screenshots/contribs_after_dark.png">
51-
<source media="(prefers-color-scheme: light)" srcset="screenshots/contribs_after_light.png">
52-
<img alt="Screenshot of GitHub contributions graph after running import-gitlab-commits with a lot of activity" src="screenshots/contribs_after_dark.png" width="1000">
53-
</picture>
51+
- `GITLAB_BASE_URL` is a GitLab [instance URL](https://stackoverflow.com/questions/58236175/what-is-a-gitlab-instance-url-and-how-can-i-get-it),
52+
e.g., `https://gitlab.com`, `https://gitlab.gnome.org`, or any GitLab server.
53+
- `GITLAB_TOKEN` is a personal [access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token).
54+
- `COMMITTER_NAME` is your GitHub name with surname, e.g., `John Doe` (can be passed to `git config user.name`).
55+
- `COMMITTER_EMAIL` is your GitHub email, e.g., `[email protected]` (valid for `git config user.email`).
56+
- `$(go env GOPATH)/bin/` is the path where `import-gitlab-commits` is installed.
5457

5558
## Internals
5659

57-
What work the tool does:
60+
What the tool does:
5861

59-
- gets current user info by `GITLAB_TOKEN`;
60-
- fetches from `GITLAB_BASE_URL` projects that the current user contributed to;
61-
- for all projects fetches commits where author's email is the current user's email;
62-
- creates new repo `repo.gitlab.yourcompany.com.currentusername` and commits all fetched commits with message
63-
`Project: GITLAB_PROJECT_ID commit: GITLAB_COMMIT_HASH`, commit date `GITLAB_COMMIT_DATE`, and commit author `COMMITTER_NAME <COMMITTER_EMAIL>`.
62+
- Retrieves current user info using `GITLAB_TOKEN`.
63+
- Fetches projects from `GITLAB_BASE_URL` that the current user contributed to.
64+
- For all projects, fetches commits where the author's email matches the current user's email.
65+
- Creates a new repository `repo.gitlab.yourcompany.com.currentusername` and commits all fetched commits with the message:
66+
`Project: GITLAB_PROJECT_ID commit: GITLAB_COMMIT_HASH`, commit date `GITLAB_COMMIT_DATE`, and commit author `COMMITTER_NAME <COMMITTER_EMAIL>`.
6467

65-
To show the changes on GitHub you need to:
68+
To display the changes on GitHub, you need to:
6669

67-
- create a new repo `yourcompany-contributions` in GitHub;
68-
- open folder `repo.gitlab.yourcompany.com.currentusername`;
69-
- add remote url `git remote add origin [email protected]:username/yourcompany-contributions.git`;
70-
- push changes.
70+
- Create a new repository `yourcompany-contributions` on GitHub.
71+
- Open the folder `repo.gitlab.yourcompany.com.currentusername`.
72+
- Add the remote URL: `git remote add origin [email protected]:username/yourcompany-contributions.git`.
73+
- Push the changes.
7174

7275
### Integration Tests
7376

7477
To run integration tests:
7578

76-
1. Set `GITLAB_TOKEN` environment variables with the value obtained at <https://gitlab.com/-/user_settings/personal_access_tokens>. Necessary scopes:
77-
- `read_api`;
78-
- `read_user`;
79-
- `read_repository`.
79+
1. Set the `GITLAB_TOKEN` environment variable with the value obtained at <https://gitlab.com/-/user_settings/personal_access_tokens>. Necessary scopes:
80+
- `read_api`
81+
- `read_user`
82+
- `read_repository`
8083

81-
2. Set `GITLAB_BASE_URL` with `https://gitlab.com`.
84+
2. Set `GITLAB_BASE_URL` to `https://gitlab.com`.
8285
3. Run `make test-integration`.

0 commit comments

Comments
 (0)