Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| contributing-to-batocera [2022/01/20 00:27] – added info about commits and how they're a required step in the whole process, amended false PR information, adjusted inlinks atari | contributing-to-batocera [2022/01/30 04:26] (current) – [Making changes in the future] a bit less contradictory phrasing atari | ||
|---|---|---|---|
| Line 101: | Line 101: | ||
| It is important to distinguish between remote and local repositories. Right now, your account has a remote repository that is a fork (copy) of Batocera.linux. We need to clone (download) this origin remote repository to your local computer to be able to make local edits to it. | It is important to distinguish between remote and local repositories. Right now, your account has a remote repository that is a fork (copy) of Batocera.linux. We need to clone (download) this origin remote repository to your local computer to be able to make local edits to it. | ||
| - | The easiest way is to open a command line, navigate to the directory you would like to save the origin repository to and run '' | + | The easiest way is to open a command line, navigate to the directory you would like to save the origin repository to and run: |
| + | |||
| + | <code bash> | ||
| + | git clone https:// | ||
| + | </ | ||
| Once done (this may take a while, depending on your internet speed), run the following: | Once done (this may take a while, depending on your internet speed), run the following: | ||
| - | * '' | + | |
| - | * '' | + | <code bash> |
| - | * '' | + | cd batocera.linux |
| - | * '' | + | git remote add upstream https:// |
| + | git remote set-url upstream https:// | ||
| + | git remote set-url origin https:// | ||
| + | </ | ||
| + | |||
| + | where '' | ||
| This will config the local repository to be recognized as a fork of upstream (the original remote repository). This makes it easier to stay "in sync" with future changes made to upstream. | This will config the local repository to be recognized as a fork of upstream (the original remote repository). This makes it easier to stay "in sync" with future changes made to upstream. | ||
| + | |||
| + | Submodules (such as buildroot) will become outdated over time. Run the following to set them up to update along with the main repository: | ||
| + | |||
| + | <code bash> | ||
| + | git submodule init | ||
| + | git submodule update | ||
| + | </ | ||
| ==== Create a local branch on your fork ==== | ==== Create a local branch on your fork ==== | ||
| Line 127: | Line 143: | ||
| ==== Making and testing the modifications ==== | ==== Making and testing the modifications ==== | ||
| - | You have some guidelines | + | You have some guidelines: |
| + | * [[:coding_rules|The coding rules page for adding new scripts]] | ||
| + | * [[: | ||
| + | * [[: | ||
| + | * [[: | ||
| ==== Commit changes to the local branch ==== | ==== Commit changes to the local branch ==== | ||
| Line 139: | Line 159: | ||
| When all the commits have been committed, merge the commits from your local clone into your fork's repository with the following command (replacing the name of the branch with your own): | When all the commits have been committed, merge the commits from your local clone into your fork's repository with the following command (replacing the name of the branch with your own): | ||
| - | < | + | < |
| git push --set-upstream origin name-of-the-branch | git push --set-upstream origin name-of-the-branch | ||
| </ | </ | ||
| Line 165: | Line 185: | ||
| - '' | - '' | ||
| - '' | - '' | ||
| + | - (Optional) '' | ||
| - | <WRAP center round info> | + | <WRAP center round tip> |
| - | It is not recommended to use ''%%git pull upstream master%%''. [[https:// | + | You can create an alias for these commands by executing the following: |
| + | |||
| + | <code bash> | ||
| + | git config --global alias.update | ||
| + | </code> | ||
| + | |||
| + | This way, running '' | ||
| </ | </ | ||
| Then repeat the steps from the [[# | Then repeat the steps from the [[# | ||
| + | |||
| + | <WRAP center round info> | ||
| + | Performing fetches and merges manually instead of relying on aliases can be quite powerful. [[https:// | ||
| + | </ | ||
| + | |||
| + | <WRAP center round tip> | ||
| + | As you create new changes and successfully complete PRs, branches can start piling up on your cloned fork. | ||
| + | |||
| + | You can remove old branches from your cloned repository by first switching to the appropriate branch ('' | ||
| + | </ | ||
| + | |||
| + | ===== Tips ===== | ||
| + | |||
| + | ==== Check all the current differences ==== | ||
| + | |||
| + | This will just show the differences in the files between now and the last commit. This is not a reflection of all the differences between the branch and the master branch. | ||
| + | |||
| + | <code bash> | ||
| + | git diff | ||
| + | </ | ||
| + | |||
| + | ==== Discard all changes ==== | ||
| + | |||
| + | This restores files back from the last commit. First, ensure you are on the branch you intend to undo the changes on, and run the following: | ||
| + | |||
| + | <code bash> | ||
| + | git restore . | ||
| + | </ | ||
| + | |||
| + | Individual files can also be specified by replacing '' | ||
| + | |||
| + | ===== Troubleshooting ===== | ||
| + | |||
| + | ==== There are changes to the buildroot submodule that I didn't make! ==== | ||
| + | |||
| + | That's why you updated the submodules earlier. But this can also happen if you say download a branch from the remote that hasn't had the submodules updated yet. To update the submodules again run the following: | ||
| + | |||
| + | <code bash> | ||
| + | git submodule update | ||
| + | </ | ||
- contributing-to-batocera.1642638425.txt.gz
- Last modified: 4 years ago
- by atari