-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: creating separate section for setting up repo with Git (#192)
- Loading branch information
Showing
3 changed files
with
78 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,47 +16,10 @@ In literally every case it is advised _**not**_ to use the `Resolve conflicts` b | |
|
||
The above will at best achieve a ready to merge pull request with visible inconsistencies. | ||
|
||
## Repository setup | ||
|
||
Fork and clone the project using the `gh` command line interface: | ||
|
||
```shell | ||
gh repo clone 0-vortex/open-sauced | ||
``` | ||
|
||
Running `git remote -v` will output: | ||
|
||
```shell | ||
origin [email protected]:0-vortex/open-sauced.git (fetch) | ||
origin [email protected]:0-vortex/open-sauced.git (push) | ||
upstream [email protected]:open-sauced/open-sauced.git (fetch) | ||
upstream [email protected]:open-sauced/open-sauced.git (push) | ||
``` | ||
|
||
Fork and clone the project using the `git` command line interface: | ||
|
||
```shell | ||
git clone [email protected]:0-vortex/open-sauced.git | ||
``` | ||
|
||
Running `git remote -v` will output: | ||
|
||
```shell | ||
origin [email protected]:0-vortex/open-sauced.git (fetch) | ||
origin [email protected]:0-vortex/open-sauced.git (push) | ||
``` | ||
|
||
As an additional step for this tutorial we need to add the `upstream` remote: | ||
|
||
```shell | ||
git remote add upstream [email protected]:open-sauced/open-sauced.git | ||
``` | ||
|
||
## Update | ||
|
||
First get the default branch changes: | ||
|
||
|
||
```shell | ||
git fetch origin --recurse-submodules=no --progress --prune | ||
git checkout main -- | ||
|
@@ -68,7 +31,6 @@ git merge upstream/main --no-stat -v | |
|
||
Then merge with the forked up-to-date `beta` (default branch): | ||
|
||
|
||
```shell | ||
git merge origin/main --no-ff -v | ||
``` | ||
|
@@ -93,7 +55,6 @@ It will look like this: | |
|
||
Since this pull request does not modify the `package.json` file it is safe to fast forward the changes from `origin/main`: | ||
|
||
|
||
```shell | ||
# overwrite with origin/main changes | ||
git show :3:package.json > package.json | ||
|
@@ -153,8 +114,9 @@ And it's ready to merge: | |
When dealing with dependency and lock file updates there are multiple use cases to consider, however as a baseline, the OpenSauced triage team will not prioritize parallel main features as seen in the roadmap. | ||
|
||
However when that happens, it is advised to: | ||
- fast-forward `npm-shrinkwrap.json` | ||
- fast-forward deleted and modified `upstream/beta` changes to `package.json` | ||
|
||
- fast-forward `npm-shrinkwrap.json` | ||
- fast-forward deleted and modified `upstream/beta` changes to `package.json` | ||
- fast-forward your added lines to `package.json` | ||
- run `npm ci` to delete local modules and create dependency resolution from `upstream/beta` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- | ||
id: setup-repo-with-git | ||
title: Setting up a repository with Git and GitHub | ||
sidebar_label: Setting up a repository with Git and GitHub | ||
keywords: | ||
- Setting up a repository with Git and GitHub | ||
--- | ||
|
||
## Using the GitHub CLI | ||
|
||
### How to install the GitHub CLI | ||
|
||
The [GitHub CLI](https://cli.github.com/) allows you to fork repositories, create issues, pull requests, and more from the command line. | ||
|
||
The GitHub CLI can be installed on Mac, Windows or Linux. You can find the complete installation instructions [here](https://github.com/cli/cli#installation). | ||
|
||
### How to authenticate with the GitHub CLI | ||
|
||
From the terminal, you will need to authenticate with the GitHub CLI. You can do this by running the following command: | ||
|
||
```shell | ||
gh auth login | ||
``` | ||
|
||
Follow the on screen prompts to authenticate with the GitHub CLI. | ||
|
||
### How to fork and clone a repository with the GitHub CLI | ||
|
||
A fork is a copy of a repository and it allows you to freely experiment with changes without affecting the original project. | ||
|
||
A clone is a local copy of a repository that includes all the files, branches, and commits. | ||
|
||
To fork and clone a repository with the GitHub CLI, run the following command: | ||
|
||
```shell | ||
gh repo fork open-sauced/REPO_NAME | ||
``` | ||
|
||
The GitHub CLI will fork the project in your GitHub account and will ask you if you want to clone the repository on your local machine. | ||
|
||
### How to view the remote repositories locally | ||
|
||
To view the remote repositories that your local repository is connected to, run the following command: | ||
|
||
```shell | ||
git remote -v | ||
``` | ||
|
||
You should see the following output: | ||
|
||
```shell | ||
origin [email protected]:YOUR_GITHUB_USERNAME/open-sauced.git (fetch) | ||
origin [email protected]:YOUR_GITHUB_USERNAME/open-sauced.git (push) | ||
upstream [email protected]:open-sauced/open-sauced.git (fetch) | ||
upstream [email protected]:open-sauced/open-sauced.git (push) | ||
``` | ||
|
||
### How to add a remote repository | ||
|
||
To pull in changes from the original repository, you will need to add a remote repository. To do this, run the following command: | ||
|
||
```shell | ||
git remote add upstream [email protected]:open-sauced/open-sauced.git | ||
``` | ||
|
||
This will allow you to pull in changes from the original repository and keep your forked copy of the repository up to date. | ||
|
||
## Using the GitHub website and the command line | ||
|
||
If you prefer to setup your repository using the GitHub website and the command line, then you can follow this detailed guide from the [official GitHub documentation](https://docs.github.com/en/get-started/quickstart/fork-a-repo). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters