mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-08 13:37:13 +08:00
* refactor: clietn in msggateway Signed-off-by: rfyiamcool <rfyiamcool@163.com> * perf: add sync.pool for req object Signed-off-by: rfyiamcool <rfyiamcool@163.com> --------- Signed-off-by: rfyiamcool <rfyiamcool@163.com> feat: use dummy pusher by default (#1349) Add Prometheus monitoring function (#1337) * Code adaptation k8s: service discovery and registration adaptation, configuration adaptation * Initial submission of the help charts script for openim API * change the help charts script * change the help charts script * change helm chart codes * change dockerfiles script * change chart script:add configmap mounts * change chart script:change repository * change chart script:msggateway add one service * change config.yaml * roll back some config values * change chart script:change Ingress rule with a rewrite annotation * add mysql charts scrible * change chart script:add mysql.config.yaml * add nfs provisioner charts * change chart script:add nfs.config.yaml * add ingress-nginx charts * change chart script:add ingress-nginx.config.yaml * add redis &mongodb charts * add kafka&minio charts * change chart script:change redis.values.yaml * change chart script:add redis.config.yaml * change chart script:change redis.config.yaml * change chart script:change mongodb.value.yaml * change chart script:change mongodb.value.yaml * change chart script:add mongodb.config.yaml * change chart script:change minio.values.yaml * change chart script:add minio.config.yaml * change chart script:change kafka.values.yaml * change chart script:add kafka.config.yaml * change chart script:change services.config.yaml * bug fix:Delete websocket's Port restrictions * bug fix:change port value * change chart script:Submit a stable version script * fix bug:Implement option interface * fix bug:change K8sDR.Register * change config.yaml * change chats script:minio service add ingress * change chats script:minio service add ingress * change chats script:kafka.replicaCount=3& change minio.api ingress * delete change chats script * change config.yaml * change openim.yaml * merge go.sum * Add monitoring function and struct for Prometheus on gin and GRPC * Add GRPC and gin server monitoring logic * Add GRPC and gin server monitoring logic2 * Add GRPC and gin server monitoring logic3 * Add GRPC and gin server monitoring logic4 * Add GRPC and gin server monitoring logic5 * Add GRPC and gin server monitoring logic6 * Add GRPC and gin server monitoring logic7 * delete:old monitoring code * add for test * fix bug:change packname * fix bug:delete getPromPort funciton * fix bug:delete getPromPort funciton * fix bug:change logs * fix bug:change registerName logic in GetGrpcCusMetrics function * add getPrometheus url api * fix:config path logic * fix:prometheus enable function * fix:prometheus enable function * fix:transfer Multi process monitoring logic * del:del not using manifest * fix:openim-msgtransfer.sh * fix:openim-msgtransfer.sh --------- Co-authored-by: lin.huang <lin.huang@apulis.com> Co-authored-by: Xinwei Xiong <3293172751@qq.com> fix: initiateUpload sign list number (#1358) * optimize scheduled deletion * optimize scheduled deletion * optimize scheduled deletion * optimize scheduled deletion * minio cache * fix: conflicts * feat: minio cache * feat: cache optimize * feat: cache optimize * feat: cache optimize * feat: cache optimize * feat: cache optimize * fix: initiateUpload sign list number fix: msg pull change and fcm redis flag fix. (#1367) * fix: to start im or chat, ZooKeeper must be started first. * fix: msg gateway start output err info Signed-off-by: Gordon <1432970085@qq.com> * fix: msg gateway start output err info Signed-off-by: Gordon <1432970085@qq.com> * chore: package path changes Signed-off-by: withchao <993506633@qq.com> * fix: go mod update Signed-off-by: Gordon <1432970085@qq.com> * fix: token update Signed-off-by: Gordon <1432970085@qq.com> * chore: package path changes Signed-off-by: withchao <993506633@qq.com> * chore: package path changes Signed-off-by: withchao <993506633@qq.com> * fix: token update Signed-off-by: Gordon <1432970085@qq.com> * fix: token update Signed-off-by: Gordon <1432970085@qq.com> * fix: token update Signed-off-by: Gordon <1432970085@qq.com> * fix: token update Signed-off-by: Gordon <1432970085@qq.com> * fix: token update Signed-off-by: Gordon <1432970085@qq.com> * fix: token update Signed-off-by: Gordon <1432970085@qq.com> * fix: get all userID Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: msggateway add online status call Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * refactor: log change Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * refactor: log change Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * chore: network mode change Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * cicd: robot automated Change Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * cicd: robot automated Change Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * cicd: robot automated Change Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * feat: add api of get server time Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * feat: remove go work sum Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * cicd: robot automated Change Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix: pull message add isRead field Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: check msg-transfer script Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: start don't kill old process Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * cicd: robot automated Change Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix: check component Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: pull message set isRead only message come from single. Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * cicd: robot automated Change Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix: multiple gateway kick user each other. Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: multiple gateway kick user each other. Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: multiple gateway kick user each other. Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: multiple gateway kick user each other. Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: multiple gateway kick user each other. Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: multiple gateway kick user each other. Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * cicd: robot automated Change Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix: multiple gateway kick user each other. Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: add ex field to update group info. Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * cicd: robot automated Change * cicd: robot automated Change * refactor: change project module name. Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * refactor: change project module name. Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * refactor: change project module name. Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * cicd: robot automated Change * test: for pressure test. Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * test: for pressure test. Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * test: for pressure test. Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * test: message log. Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * cicd: robot automated Change * fxi: component check output valid info. Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fxi: component check output valid info. Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * test: send message test log. Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * cicd: robot automated Change * cicd: robot automated Change * test: remove info log. Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * feat: api of send message add sendTime field. Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: add callback for update user's info. * cicd: robot automated Change * fix: change callback command name. * cicd: robot automated Change * fix: single chat unread status change. * fix: single chat unread status change. * fix: single chat unread status change. * fix: user status change. * cicd: robot automated Change * fix: user status change. * fix: user status change. * fix: user status change. * cicd: robot automated Change * fix: ws close when user logout. * fix: remove repeat platform on online status. * cicd: robot automated Change * fix: api send messages for notification conversation . * fix: api send messages for notification conversation . * fix: api send messages for notification conversation . * fix: api send messages for notification conversation . * fix: api send messages for notification conversation . * fix: api send messages for notification conversation. * fix: api send messages for notification conversation. * fix: api send messages for notification conversation. * fix: api send messages for notification conversation. * fix: api send messages for notification conversation. * fix: api send messages for notification conversation. * re: remove router of unsubscribeStatus. * re: remove router of unsubscribeStatus. * re: remove router of unsubscribeStatus. * re: remove router of unsubscribeStatus. * fix: reset branch * fix: not support redis cluster. CROSSSLOT Keys in request don't hash to the same slot * fix: update user.FaceURL do not trigger GroupMemberInfoSetNotification * cicd: robot automated Change * fix: api send messages for notification conversation. * fix: api send messages for notification conversation. * fix: zk add close to avoid zk block. * fix: go mod update. * fix: msg pull change and fcm redis flag fix. --------- Signed-off-by: Gordon <1432970085@qq.com> Signed-off-by: withchao <993506633@qq.com> Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: withchao <993506633@qq.com> Co-authored-by: Xinwei Xiong <3293172751NSS@gmail.com> Co-authored-by: FGadvancer <FGadvancer@users.noreply.github.com> Co-authored-by: withchao <withchao@users.noreply.github.com> fix: sync close ws conn when kick old user avoid wrong trigger order about online status. (#1368) Update README-zh_CN.md Update README-zh_CN.md fix: GetUserReqApplicationList error when there is a disbanded group chat (#1374) fix: error when querying some information about disbanded group (#1376) * fix: GetUserReqApplicationList error when there is a disbanded group chat * fix: error when querying some information about disbanded group fix: GetUserReqApplicationList dismissed group error (#1378) * fix: GetUserReqApplicationList error when there is a disbanded group chat * fix: error when querying some information about disbanded group * fix: GetUserReqApplicationList dismissed group error refactor: lower the level of code nesting (#1370) * refactor: lower the level of code nesting Signed-off-by: rfyiamcool <rfyiamcool@163.com> * refactor: lower the level of code nesting Signed-off-by: rfyiamcool <rfyiamcool@163.com> --------- Signed-off-by: rfyiamcool <rfyiamcool@163.com> ☀️ feat: Enhancing OpenIM with Integrated E2E Testing and CI/CD Enhancements (#1359) * cicd: robot automated Change * feat: add api test Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add api test make file Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add openim e2e test Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add openim e2e test Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * fix: Fixed some unused scripts and some names Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * docs: optimize openim docs Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add prom address Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add openim info test * feat: add openim images config path Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * fix: fix tim file rename * fix: fix tim file rename * fix: fix tim file rename * fix: fix tim file rename * fix: add openim test e2e * feat: add openim test .keep Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add openim test .keep Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: openim test Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: openim test Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: openim test Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> --------- Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> Co-authored-by: cubxxw <cubxxw@users.noreply.github.com> perf: auto set runtime maxprocs in docker (#1339) Signed-off-by: rfyiamcool <rfyiamcool@163.com> build: build openim image (#1381) perf: improve gzip performance with sync.pool (#1321) Signed-off-by: rfyiamcool <rfyiamcool@163.com> Co-authored-by: Gordon <46924906+FGadvancer@users.noreply.github.com> fix: add kafka compress type and producer ack params (#1310) Signed-off-by: rfyiamcool <rfyiamcool@163.com> delete not using files cicd: robot automated Change add prometheus docker-compose for monitor fix prometheus.yaml fix environment.sh fix init-config.sh fix init-config.sh fix env_template.yaml fix docker-compose.yml fix docker-compose.yml add openim_admin_front service change openim-admin-front del not using files add node-exporter-dashaboard.yaml
284 lines
9.4 KiB
Markdown
284 lines
9.4 KiB
Markdown
---
|
|
title: "GitHub Workflow"
|
|
weight: 6
|
|
description: |
|
|
This document is an overview of the GitHub workflow used by the
|
|
open-im-server project. It includes tips and suggestions on keeping your
|
|
local environment in sync with upstream and how to maintain good
|
|
commit hygiene.
|
|
---
|
|
|
|

|
|
|
|
## 1. Fork in the cloud
|
|
|
|
1. Visit https://github.com/openimsdk/open-im-server
|
|
2. Click `Fork` button (top right) to establish a cloud-based fork.
|
|
|
|
## 2. Clone fork to local storage
|
|
|
|
Per Go's [workspace instructions][go-workspace], place open-im-server' code on your
|
|
`GOPATH` using the following cloning procedure.
|
|
|
|
[go-workspace]: https://golang.org/doc/code.html#Workspaces
|
|
|
|
In your shell, define a local working directory as `working_dir`. If your `GOPATH` has multiple paths, pick
|
|
just one and use it instead of `$GOPATH`. You must follow exactly this pattern,
|
|
neither `$GOPATH/src/github.com/${your github profile name}/`
|
|
nor any other pattern will work.
|
|
|
|
```sh
|
|
export working_dir="$(go env GOPATH)/src/k8s.io"
|
|
```
|
|
|
|
If you already do Go development on github, the `k8s.io` directory
|
|
will be a sibling to your existing `github.com` directory.
|
|
|
|
Set `user` to match your github profile name:
|
|
|
|
```sh
|
|
export user=<your github profile name>
|
|
```
|
|
|
|
Both `$working_dir` and `$user` are mentioned in the figure above.
|
|
|
|
Create your clone:
|
|
|
|
```sh
|
|
mkdir -p $working_dir
|
|
cd $working_dir
|
|
git clone https://github.com/$user/open-im-server.git
|
|
# or: git clone git@github.com:$user/open-im-server.git
|
|
|
|
cd $working_dir/open-im-server
|
|
git remote add upstream https://github.com/openimsdk/open-im-server.git
|
|
# or: git remote add upstream git@github.com:openimsdk/open-im-server.git
|
|
|
|
# Never push to upstream master
|
|
git remote set-url --push upstream no_push
|
|
|
|
# Confirm that your remotes make sense:
|
|
git remote -v
|
|
```
|
|
|
|
## 3. Create a Working Branch
|
|
|
|
Get your local master up to date. Note that depending on which repository you are working from,
|
|
the default branch may be called "main" instead of "master".
|
|
|
|
```sh
|
|
cd $working_dir/open-im-server
|
|
git fetch upstream
|
|
git checkout master
|
|
git rebase upstream/master
|
|
```
|
|
|
|
Create your new branch.
|
|
|
|
```sh
|
|
git checkout -b myfeature
|
|
```
|
|
|
|
You may now edit files on the `myfeature` branch.
|
|
|
|
### Building open-im-server
|
|
|
|
This workflow is process-specific. For quick-start build instructions for [openimsdk/open-im-server](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/util-makefile.md)
|
|
|
|
## 4. Keep your branch in sync
|
|
|
|
You will need to periodically fetch changes from the `upstream`
|
|
repository to keep your working branch in sync. Note that depending on which repository you are working from,
|
|
the default branch may be called 'main' instead of 'master'.
|
|
|
|
Make sure your local repository is on your working branch and run the
|
|
following commands to keep it in sync:
|
|
|
|
```sh
|
|
git fetch upstream
|
|
git rebase upstream/master
|
|
```
|
|
|
|
Please don't use `git pull` instead of the above `fetch` and
|
|
`rebase`. Since `git pull` executes a merge, it creates merge commits. These make the commit history messy
|
|
and violate the principle that commits ought to be individually understandable
|
|
and useful (see below).
|
|
|
|
You might also consider changing your `.git/config` file via
|
|
`git config branch.autoSetupRebase always` to change the behavior of `git pull`, or another non-merge option such as `git pull --rebase`.
|
|
|
|
## 5. Commit Your Changes
|
|
|
|
You will probably want to regularly commit your changes. It is likely that you will go back and edit,
|
|
build, and test multiple times. After a few cycles of this, you might
|
|
[amend your previous commit](https://www.w3schools.com/git/git_amend.asp).
|
|
|
|
```sh
|
|
git commit
|
|
```
|
|
|
|
## 6. Push to GitHub
|
|
|
|
When your changes are ready for review, push your working branch to
|
|
your fork on GitHub.
|
|
|
|
```sh
|
|
git push -f <your_remote_name> myfeature
|
|
```
|
|
|
|
## 7. Create a Pull Request
|
|
|
|
1. Visit your fork at `https://github.com/<user>/open-im-server`
|
|
2. Click the **Compare & Pull Request** button next to your `myfeature` branch.
|
|
3. Check out the pull request process for more details and
|
|
advice.
|
|
|
|
_If you have upstream write access_, please refrain from using the GitHub UI for
|
|
creating PRs, because GitHub will create the PR branch inside the main
|
|
repository rather than inside your fork.
|
|
|
|
### Get a code review
|
|
|
|
Once your pull request has been opened it will be assigned to one or more
|
|
reviewers. Those reviewers will do a thorough code review, looking for
|
|
correctness, bugs, opportunities for improvement, documentation and comments,
|
|
and style.
|
|
|
|
Commit changes made in response to review comments to the same branch on your
|
|
fork.
|
|
|
|
Very small PRs are easy to review. Very large PRs are very difficult to review.
|
|
|
|
### Squash commits
|
|
|
|
After a review, prepare your PR for merging by squashing your commits.
|
|
|
|
All commits left on your branch after a review should represent meaningful milestones or units of work. Use commits to add clarity to the development and review process.
|
|
|
|
Before merging a PR, squash the following kinds of commits:
|
|
|
|
- Fixes/review feedback
|
|
- Typos
|
|
- Merges and rebases
|
|
- Work in progress
|
|
|
|
Aim to have every commit in a PR compile and pass tests independently if you can, but it's not a requirement. In particular, `merge` commits must be removed, as they will not pass tests.
|
|
|
|
To squash your commits, perform an [interactive rebase](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History):
|
|
|
|
1. Check your git branch:
|
|
|
|
```
|
|
git status
|
|
```
|
|
|
|
The output should be similar to this:
|
|
|
|
```
|
|
On branch your-contribution
|
|
Your branch is up to date with 'origin/your-contribution'.
|
|
```
|
|
|
|
2. Start an interactive rebase using a specific commit hash, or count backwards from your last commit using `HEAD~<n>`, where `<n>` represents the number of commits to include in the rebase.
|
|
|
|
```
|
|
git rebase -i HEAD~3
|
|
```
|
|
|
|
The output should be similar to this:
|
|
|
|
```
|
|
pick 2ebe926 Original commit
|
|
pick 31f33e9 Address feedback
|
|
pick b0315fe Second unit of work
|
|
|
|
# Rebase 7c34fc9..b0315ff onto 7c34fc9 (3 commands)
|
|
#
|
|
# Commands:
|
|
# p, pick <commit> = use commit
|
|
# r, reword <commit> = use commit, but edit the commit message
|
|
# e, edit <commit> = use commit, but stop for amending
|
|
# s, squash <commit> = use commit, but meld into previous commit
|
|
# f, fixup <commit> = like "squash", but discard this commit's log message
|
|
|
|
...
|
|
|
|
```
|
|
|
|
3. Use a command line text editor to change the word `pick` to `squash` for the commits you want to squash, then save your changes and continue the rebase:
|
|
|
|
```
|
|
pick 2ebe926 Original commit
|
|
squash 31f33e9 Address feedback
|
|
pick b0315fe Second unit of work
|
|
|
|
...
|
|
|
|
```
|
|
|
|
The output after saving changes should look similar to this:
|
|
|
|
```
|
|
[detached HEAD 61fdded] Second unit of work
|
|
Date: Thu Mar 5 19:01:32 2020 +0100
|
|
2 files changed, 15 insertions(+), 1 deletion(-)
|
|
|
|
...
|
|
|
|
Successfully rebased and updated refs/heads/master.
|
|
```
|
|
4. Force push your changes to your remote branch:
|
|
|
|
```
|
|
git push --force
|
|
```
|
|
|
|
For mass automated fixups such as automated doc formatting, use one or more
|
|
commits for the changes to tooling and a final commit to apply the fixup en
|
|
masse. This makes reviews easier.
|
|
|
|
An alternative to this manual squashing process is to use the Prow and Tide based automation that is configured in GitHub: adding a comment to your PR with `/label tide/merge-method-squash` will trigger the automation so that GitHub squash your commits onto the target branch once the PR is approved. Using this approach simplifies things for those less familiar with Git, but there are situations in where it's better to squash locally; reviewers will have this in mind and can ask for manual squashing to be done.
|
|
|
|
By squashing locally, you control the commit message(s) for your work, and can separate a large PR into logically separate changes.
|
|
For example: you have a pull request that is code complete and has 24 commits. You rebase this against the same merge base, simplifying the change to two commits. Each of those two commits represents a single logical change and each commit message summarizes what changes. Reviewers see that the set of changes are now understandable, and approve your PR.
|
|
|
|
## Merging a commit
|
|
|
|
Once you've received review and approval, your commits are squashed, your PR is ready for merging.
|
|
|
|
Merging happens automatically after both a Reviewer and Approver have approved the PR. If you haven't squashed your commits, they may ask you to do so before approving a PR.
|
|
|
|
## Reverting a commit
|
|
|
|
In case you wish to revert a commit, use the following instructions.
|
|
|
|
_If you have upstream write access_, please refrain from using the
|
|
`Revert` button in the GitHub UI for creating the PR, because GitHub
|
|
will create the PR branch inside the main repository rather than inside your fork.
|
|
|
|
- Create a branch and sync it with upstream. Note that depending on which repository you are working from, the default branch may be called 'main' instead of 'master'.
|
|
```sh
|
|
# create a branch
|
|
git checkout -b myrevert
|
|
|
|
# sync the branch with upstream
|
|
git fetch upstream
|
|
git rebase upstream/master
|
|
```
|
|
- If the commit you wish to revert is a *merge commit*, use this command:
|
|
```sh
|
|
# SHA is the hash of the merge commit you wish to revert
|
|
git revert -m 1 <SHA>
|
|
```
|
|
If it is a *single commit*, use this command:
|
|
```sh
|
|
# SHA is the hash of the single commit you wish to revert
|
|
git revert <SHA>
|
|
```
|
|
|
|
- This will create a new commit reverting the changes. Push this new commit to your remote.
|
|
```sh
|
|
git push <your_remote_name> myrevert
|
|
```
|
|
|
|
- Finally, [create a Pull Request](#7-create-a-pull-request) using this branch. |