hackforla / hackforla/peopledepot
Add missing documentation on how to apply changes from one file to another in Github
- Dominant language
- Python
- Stars
- 14
- Forks
- 37
- Avg merge
- 9d 15h
- Merged PRs (30d)
- 5
Description
### Overview
We need to add a description of how to apply changes from one GitHub file to another, so that developers can synchronize changes and keep files up-to-date.
### Action Items
- [ ] Add content in the What's missing? section below to a new numbered item and linked page here: https://hackforla.github.io/peopledepot/contributing/howto/, editing or revising if necessary
### Resources/Instructions/Tags
- 1.01 git, diff, patch, moved content
### Documentation Addition Notes
#### What's missing?
Here's how to apply changes from one GitHub file to another:
1. Rebase/Merge your feature branch to `main`.
2. Undo changes to the file you changed (replacing `CONTRIBUTING.md` with the relevant filename):
```bash
git reset upstream/main -- CONTRIBUTING.md
```
3. Now switch to the unmerged branch with the changes (replacing `our-branch-original` with the relevant branch name):
```bash
git switch our-branch-original
```
4. Create a patch of the changes (replacing with relevant filename):
```bash
git format-patch hackforla/main CONTRIBUTING.md
# only changes to CONTRIBUTING.md
# include changes since we branched off from hackforla/main
# may need to create a temporary branch where hackforla/main used to be for this command
# output:
# 0001-add-to-dev-environment.patch
```
5. Switch to the rebased branch without the changes to the file (in this example `CONTRIBUTING.md`):
```bash
git switch our-branch-rebased
```
6. Apply the patch to the other file (in this example, `docs/contributing/dev_environment.md`:
```bash
patch -p1 docs/contributing/dev_environment.md 0001-add-to-dev-environment.patch
```
#### Where should it go?
- A new numbered item and linked page here: https://hackforla.github.io/peopledepot/contributing/howto/, editing or revising if necessary
#### When would this information have been useful?
- This information would be useful in situations where complex changes have been made - for example::
1. You made a change to `CONTRIBUTING.md`, unmerged.
1. Another dev split `CONTRIBUTING.md` into several files and it's merged into `main`.
- The place you made the change in `CONTRIBUTING.md` is now in a file called `contributing/dev_environment.md`
- git can't merge your change automatically. (git tracks renames, but not splits)
1. By using the patch described above to apply the change semi-automatically, you can avoid having to type (copy/paste) the change manually into `contributing/dev_environment.md`
#### Which roles will benefit most from this information?
- Backend/ Dev
Contributor guide
Assessment
This issue has not been assessed yet.