base
Into an Existing RepositoryThis guide explains how to merge the attogram/base
repository into your
existing project.
This is useful for incorporating the base
features, such as the Docker
environment and GitHub Actions, into a project that has already been started.
There are two ways to do this: an easy method using the GitHub web interface, and an advanced method using the command line on your local machine.
This section explains how to perform the first merge of base
into your
repository.
This method is recommended if you are not familiar with the command line or do not have Git installed on your machine. It uses GitHub Codespaces, which provides a development environment that runs in your browser.
Navigate to Your Repository: Go to the main page of your own existing repository on GitHub.
base
as a remote: This tells Git where to find the
attogram/base
repository.
git remote add base https://github.com/attogram/base.git
base
: This downloads the base
repository and
merges it into your project.
git fetch base
git merge base/main --allow-unrelated-histories
<<<<<<<
,
=======
, >>>>>>>
).This method is for users who are comfortable with the command line and have Git installed on their local machine.
Add base
as a Remote:
First, you need to add the base
repository as a remote to your local Git
repository.
This allows you to fetch its branches and history.
git remote add base https://github.com/attogram/base.git
Fetch and Merge base
:
Next, fetch the base
repository’s history and merge its main
branch
into your project’s main branch.
git fetch base
git merge base/main --allow-unrelated-histories
git status
to see a list of files with conflicts.git add .
.git commit
.After the initial merge, you can pull in future updates from base
by running
the following commands:
git fetch base
git merge base/main
You may need to resolve merge conflicts again, just as you did during the initial merge.
If you only want to incorporate a small part of the base
repository, like a
specific workflow or configuration file, you can simply copy and paste it into
your own project.
For example, you can copy the contents of the
.github/
directory to
get the latest GitHub Actions workflows.
This method is simpler than a full merge, but you will need to manually update
the files if you want to get future updates from base
.