Document features and changes for phase 2.5 of master/main transition (#15745)
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
---
|
||||
title: Changing the default branch
|
||||
intro: 'If you have more than one branch in your repository, you can configure any branch as the default branch.'
|
||||
permissions: People with admin permissions to a repository can change the default branch for the repository.
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
redirect_from:
|
||||
- /github/administering-a-repository/setting-the-default-branch
|
||||
- /articles/setting-the-default-branch
|
||||
---
|
||||
|
||||
### About changing the default branch
|
||||
|
||||
You can choose the default branch for a repository. The default branch is the base branch for pull requests and code commits. For more information about the default branch, see "[About branches](/github/collaborating-with-issues-and-pull-requests/about-branches#about-the-default-branch)."
|
||||
|
||||
{% note %}
|
||||
|
||||
**Note**: If you use the Git-Subversion bridge, setting a different default branch will affect your `trunk` branch contents and the `HEAD` you see when you list references for the remote repository. For more information, see "[Support for Subversion clients](/github/importing-your-projects-to-github/support-for-subversion-clients)" and [git-ls-remote](https://git-scm.com/docs/git-ls-remote.html) in the Git documentation.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.22" %}
|
||||
|
||||
{% data reusables.branches.set-default-branch %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
### Prerequisites
|
||||
|
||||
To change the default branch, your repository must have more than one branch. For more information, see "[Creating and deleting branches within your repository](/github/collaborating-with-issues-and-pull-requests/creating-and-deleting-branches-within-your-repository#creating-a-branch)."
|
||||
|
||||
### Changing the default branch
|
||||
|
||||
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.22" %}
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
{% data reusables.repositories.repository-branches %}
|
||||
1. Under "Default branch", to the right of the default branch name, click {% octicon "arrow-switch" aria-label="The switch icon with two arrows" %}.
|
||||

|
||||
1. Use the drop-down, then click a branch name.
|
||||

|
||||
1. Click **Update**.
|
||||

|
||||
1. Read the warning, then click **I understand, update the default branch.**
|
||||

|
||||
|
||||
{% else %}
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
{% data reusables.repositories.repository-branches %}
|
||||
4. In the default branch drop-down, choose the new default branch.
|
||||

|
||||
5. Click **Update**.
|
||||
|
||||
{% endif %}
|
||||
@@ -41,8 +41,8 @@ versions:
|
||||
{% link_in_list /restoring-a-deleted-repository %}
|
||||
<!-- endif -->
|
||||
{% topic_link_in_list /managing-branches-in-your-repository %}
|
||||
{% link_in_list /setting-the-default-branch %}
|
||||
{% link_in_list /viewing-branches-in-your-repository %}
|
||||
{% link_in_list /changing-the-default-branch %}
|
||||
{% link_in_list /deleting-and-restoring-branches-in-a-pull-request %}
|
||||
{% topic_link_in_list /configuring-pull-request-merges %}
|
||||
{% link_in_list /about-merge-methods-on-github %}
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
---
|
||||
title: Setting the default branch
|
||||
intro: 'If you have more than one branch in your repository, you can choose another branch to be the default branch.'
|
||||
redirect_from:
|
||||
- /articles/setting-the-default-branch
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
---
|
||||
|
||||
### About the default branch
|
||||
|
||||
{% data reusables.branches.new-repo-default-branch %} {% data reusables.branches.default-branch-automatically-base-branch %} If you have more than one branch in your repository, anyone with admin rights over a repository can select one of these existing branches as the default branch on the repository.
|
||||
|
||||
### Setting the default branch
|
||||
|
||||
{% note %}
|
||||
|
||||
**Note:** To set the default branch you must have more than one branch in your repository.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
{% data reusables.repositories.repository-branches %}
|
||||
4. In the default branch drop-down, choose the new default branch.
|
||||

|
||||
5. Click **Update**.
|
||||
|
||||
You can only switch between branches that already exist on {% data variables.product.product_location %}. To create a new branch through the UI, see "[Creating and deleting branches within your repository](/articles/creating-and-deleting-branches-within-your-repository)".
|
||||
|
||||
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.22" %}
|
||||
|
||||
You can also set the default branch name for any newly created repositories owned by your user account, organization, or enterprise account. For more information, see "[Managing the default branch for your repositories](/github/setting-up-and-managing-your-github-user-account/managing-the-default-branch-name-for-your-repositories)", "[Managing the default branch name for repositories in your organization](/github/setting-up-and-managing-organizations-and-teams/managing-the-default-branch-name-for-repositories-in-your-organization), or "[Enforcing a policy on the default branch name](/github/setting-up-and-managing-your-enterprise-account/enforcing-repository-management-policies-in-your-enterprise-account#enforcing-a-policy-on-the-default-branch-name)."
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% warning %}
|
||||
|
||||
**Warning**: Setting a different default branch affects your `trunk` branch contents on the [Git-Subversion bridge](https://github.com/blog/1178-collaborating-on-github-with-subversion) and the `HEAD` you'd see when you `git ls-remote` this [repository's upstream URL](https://git-scm.com/docs/git-ls-remote.html).
|
||||
|
||||
{% endwarning %}
|
||||
@@ -9,8 +9,8 @@ versions:
|
||||
The error you receive may look like the following:
|
||||
|
||||
```shell
|
||||
$ git push -u github.master
|
||||
> fatal: 'github.master' does not appear to be a git repository
|
||||
$ git push -u github.main
|
||||
> fatal: 'github.main' does not appear to be a git repository
|
||||
> fatal: The remote end hung up unexpectedly
|
||||
|
||||
$ git pull -u github
|
||||
|
||||
@@ -74,7 +74,7 @@ To illustrate how `git filter-branch` works, we'll show you how to remove your f
|
||||
"git rm --cached --ignore-unmatch <em>PATH-TO-YOUR-FILE-WITH-SENSITIVE-DATA</em>" \
|
||||
--prune-empty --tag-name-filter cat -- --all
|
||||
> Rewrite 48dc599c80e20527ed902928085e7861e6b3cbe6 (266/266)
|
||||
> Ref 'refs/heads/master' was rewritten
|
||||
> Ref 'refs/heads/main' was rewritten
|
||||
```
|
||||
|
||||
{% note %}
|
||||
@@ -89,7 +89,7 @@ To illustrate how `git filter-branch` works, we'll show you how to remove your f
|
||||
$ echo "<em>YOUR-FILE-WITH-SENSITIVE-DATA</em>" >> .gitignore
|
||||
$ git add .gitignore
|
||||
$ git commit -m "Add <em>YOUR-FILE-WITH-SENSITIVE-DATA</em> to .gitignore"
|
||||
> [master 051452f] Add <em>YOUR-FILE-WITH-SENSITIVE-DATA</em> to .gitignore
|
||||
> [main 051452f] Add <em>YOUR-FILE-WITH-SENSITIVE-DATA</em> to .gitignore
|
||||
> 1 files changed, 1 insertions(+), 0 deletions(-)
|
||||
```
|
||||
5. Double-check that you've removed everything you wanted to from your repository's history, and that all of your branches are checked out.
|
||||
@@ -102,7 +102,7 @@ To illustrate how `git filter-branch` works, we'll show you how to remove your f
|
||||
> Writing objects: 100% (1058/1058), 148.85 KiB, done.
|
||||
> Total 1058 (delta 590), reused 602 (delta 378)
|
||||
> To https://{% data variables.command_line.codeblock %}/<em>YOUR-USERNAME</em>/<em>YOUR-REPOSITORY</em>.git
|
||||
> + 48dc599...051452f master -> master (forced update)
|
||||
> + 48dc599...051452f main -> main (forced update)
|
||||
```
|
||||
7. In order to remove the sensitive file from [your tagged releases](/articles/about-releases), you'll also need to force-push against your Git tags:
|
||||
```shell
|
||||
@@ -113,7 +113,7 @@ To illustrate how `git filter-branch` works, we'll show you how to remove your f
|
||||
> Writing objects: 100% (321/321), 331.74 KiB | 0 bytes/s, done.
|
||||
> Total 321 (delta 124), reused 269 (delta 108)
|
||||
> To https://{% data variables.command_line.codeblock %}/<em>YOUR-USERNAME</em>/<em>YOUR-REPOSITORY</em>.git
|
||||
> + 48dc599...051452f master -> master (forced update)
|
||||
> + 48dc599...051452f main -> main (forced update)
|
||||
```
|
||||
8. Contact {% data variables.contact.contact_support %}, asking them to remove cached views and references to the sensitive data in pull requests on {% data variables.product.product_name %}.
|
||||
9. Tell your collaborators to [rebase](https://git-scm.com/book/en/Git-Branching-Rebasing), *not* merge, any branches they created off of your old (tainted) repository history. One merge commit could reintroduce some or all of the tainted history that you just went to the trouble of purging.
|
||||
|
||||
@@ -32,7 +32,7 @@ versions:
|
||||
9. Enter a commit message describing your changes.
|
||||

|
||||
10. Below the commit message fields, decide whether to commit your template directly to the default branch, or to create a new branch and open a pull request. For more information about pull requests, see "[About pull requests](/articles/about-pull-requests)."
|
||||

|
||||

|
||||
11. Click **Commit changes**. Once these changes are merged into the default branch, the template will be available for contributors to use when they open new issues in the repository.
|
||||
|
||||
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.19" %}
|
||||
|
||||
@@ -10,28 +10,30 @@ versions:
|
||||
---
|
||||
|
||||
|
||||
### Introducing branches
|
||||
### About branches
|
||||
|
||||
Branches allow you to develop features, fix bugs, or safely experiment with new ideas in a contained area of your repository.
|
||||
|
||||
You always create a branch from an existing branch. Typically, you might create a new branch from the default branch of your repository. You can then work on this new branch in isolation from changes that other people are making to the repository. A branch you create to build a feature is commonly referred to as a feature branch or topic branch. For more information, see "[Creating and deleting branches within your repository](/articles/creating-and-deleting-branches-within-your-repository/)."
|
||||
|
||||
You can also use a branch to publish a {% data variables.product.prodname_pages %} site. For more information, see "[What is {% data variables.product.prodname_dotcom %} Pages?](/articles/what-is-github-pages)"
|
||||
You can also use a branch to publish a {% data variables.product.prodname_pages %} site. For more information, see "[About {% data variables.product.prodname_pages %}](/articles/what-is-github-pages)."
|
||||
|
||||
You must have write access to a repository to create a branch, open a pull request, or delete and restore branches in a pull request. For more information, see "[Access permissions on {% data variables.product.product_name %}](/articles/access-permissions-on-github)."
|
||||
You must have write access to a repository to create a branch, open a pull request, or delete and restore branches in a pull request. For more information, see "[Access permissions on {% data variables.product.prodname_dotcom %}](/github/getting-started-with-github/access-permissions-on-github)."
|
||||
|
||||
### About the default branch
|
||||
|
||||
{% data reusables.branches.new-repo-default-branch %} The default branch is the branch that {% data variables.product.prodname_dotcom %} displays when anyone visits your repository. The default branch is also the initial branch that Git checks out locally out when someone clones the repository. {% data reusables.branches.default-branch-automatically-base-branch %}
|
||||
|
||||
By default, {% data variables.product.product_name %} names the default branch {% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.23" %}`main`{% else %}`master`{% endif %} in any new repository.
|
||||
|
||||
{% data reusables.branches.change-default-branch %}
|
||||
|
||||
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.22" %}
|
||||
|
||||
By default, the default branch name is `master`, but you can set the name to anything that makes sense for your workflow. For more information on the default branch name, see "[Managing the default branch name for your repositories](/github/setting-up-and-managing-your-github-user-account/managing-the-default-branch-name-for-your-repositories)."
|
||||
{% data reusables.branches.set-default-branch %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% data reusables.branches.set-default-branch %}
|
||||
|
||||
### Working with branches
|
||||
|
||||
Once you're satisfied with your work, you can open a pull request to merge the changes in the current branch (the *head* branch) into another branch (the *base* branch). For more information, see "[About pull requests](/articles/about-pull-requests)."
|
||||
|
||||
@@ -18,7 +18,7 @@ You can specify which branch you'd like to merge your changes into when you crea
|
||||
|
||||
### Changing the branch range and destination repository
|
||||
|
||||
By default, pull requests are based on the parent repository's [default branch](/articles/setting-the-default-branch).
|
||||
By default, pull requests are based on the parent repository's default branch. For more information, see "[About branches](/github/collaborating-with-issues-and-pull-requests/about-branches#about-the-default-branch)."
|
||||
|
||||
If the default parent repository isn't correct, you can change both the parent repository and the branch with the drop-down lists. You can also swap your head and base branches with the drop-down lists to establish diffs between reference points. References here must be branch names in your GitHub repository.
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ versions:
|
||||
|
||||
{% data reusables.pull_requests.automatically-delete-branches %}
|
||||
|
||||
If the branch you want to delete is the repository's default branch, you must choose a new default branch before deleting the branch. For more information, see "[Setting the default branch](/github/administering-a-repository/setting-the-default-branch)."
|
||||
If the branch you want to delete is the repository's default branch, you must choose a new default branch before deleting the branch. For more information, see "[Changing the default branch](/github/administering-a-repository/changing-the-default-branch)."
|
||||
|
||||
If the branch you want to delete is associated with an open pull request, you must merge or close the pull request before deleting the branch. For more information, see "[Merging a pull request](/github/collaborating-with-issues-and-pull-requests/merging-a-pull-request)" or "[Closing a pull request](/github/collaborating-with-issues-and-pull-requests/closing-a-pull-request)."
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ versions:
|
||||
2. Change the current working directory to your local project.
|
||||
3. Check out the branch you wish to merge to. Usually, you will merge into the default branch.
|
||||
```shell
|
||||
$ git checkout <em>master</em>
|
||||
$ git checkout <em>DEFAULT_BRANCH_NAME</em>
|
||||
```
|
||||
4. Pull the desired branch from the upstream repository. This method will retain the commit history without modification.
|
||||
```shell
|
||||
@@ -22,5 +22,5 @@ versions:
|
||||
7. Review the changes and ensure they are satisfactory.
|
||||
8. Push the merge to your GitHub repository.
|
||||
```shell
|
||||
$ git push origin <em>master</em>
|
||||
$ git push origin <em>DEFAULT_BRANCH_NAME</em>
|
||||
```
|
||||
|
||||
@@ -83,8 +83,8 @@ For example, if you edited a file, such as *README.md*, and another person remov
|
||||
2. Generate a list of the files affected by the merge conflict. In this example, the file *README.md* has a merge conflict.
|
||||
```shell
|
||||
$ git status
|
||||
> # On branch master
|
||||
> # Your branch and 'origin/master' have diverged,
|
||||
> # On branch main
|
||||
> # Your branch and 'origin/main' have diverged,
|
||||
> # and have 1 and 2 different commits each, respectively.
|
||||
> # (use "git pull" to merge the remote branch into yours)
|
||||
> # You have unmerged paths.
|
||||
|
||||
@@ -21,7 +21,7 @@ Total 3 (delta 0), reused 0 (delta 0)
|
||||
remote: always_reject.sh: failed with exit status 1
|
||||
remote: error: rejecting all pushes
|
||||
To https://54.204.174.51/hodor/nope.git
|
||||
! [remote rejected] master -> master (pre-receive hook declined)
|
||||
! [remote rejected] main -> main (pre-receive hook declined)
|
||||
error: failed to push some refs to 'https://54.204.174.51/hodor/nope.git'
|
||||
```
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ If your commit is not on the default branch, an indicator will show the branches
|
||||
|
||||
Once the commit is on the default branch, any tags that contain the commit will be shown and the default branch will be the only branch listed.
|
||||
|
||||

|
||||

|
||||
|
||||
### Further reading
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ To learn more about other comparison options, see "[Three-dot and two-dot diff c
|
||||
|
||||
You can compare your base repository and any forked repository. This is the view that's presented when a user performs a Pull Request to a project.
|
||||
|
||||
To compare branches on different repositories, preface the branch names with user names. For example, by specifying `octocat:master` for `base` and `octo-org:master` for `compare`, you can compare the `master` branch of the repositories respectively owned by `octocat` and `octo-org`.
|
||||
To compare branches on different repositories, preface the branch names with user names. For example, by specifying `octocat:main` for `base` and `octo-org:main` for `compare`, you can compare the `main` branch of the repositories respectively owned by `octocat` and `octo-org`.
|
||||
|
||||
Here's an example of a [comparison between two repositories](https://github.com/octocat/linguist/compare/master...octo-org:master).
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ $ git clone https://{% data variables.command_line.codeblock %}/<em>user</em>/<e
|
||||
```
|
||||
|
||||
To fix the error, you'll need to be an administrator of the repository on {% data variables.product.product_location %}.
|
||||
You'll want to [change the default branch](/articles/setting-the-default-branch) of the repository.
|
||||
You'll want to [change the default branch](/github/administering-a-repository/changing-the-default-branch) of the repository.
|
||||
|
||||
After that, you can get a list of all the available branches from the command line:
|
||||
|
||||
@@ -32,14 +32,14 @@ $ git branch -a
|
||||
# Lists ALL the branches
|
||||
> remotes/origin/awesome
|
||||
> remotes/origin/more-work
|
||||
> remotes/origin/new-master
|
||||
> remotes/origin/new-main
|
||||
```
|
||||
|
||||
Then, you can just switch to your new branch:
|
||||
|
||||
```shell
|
||||
$ git checkout new-master
|
||||
$ git checkout new-main
|
||||
# Create and checkout a tracking branch
|
||||
> Branch new-master set up to track remote branch new-master from origin.
|
||||
> Switched to a new branch 'new-master'
|
||||
> Branch new-main set up to track remote branch new-main from origin.
|
||||
> Switched to a new branch 'new-main'
|
||||
```
|
||||
|
||||
@@ -49,7 +49,7 @@ versions:
|
||||
```
|
||||
9. [Push the changes](/articles/pushing-commits-to-a-remote-repository/) in your local repository to {% data variables.product.product_location %}.
|
||||
```shell
|
||||
$ git push -u origin master
|
||||
$ git push -u origin main
|
||||
# Pushes the changes in your local repository up to the remote repository you specified as the origin
|
||||
```
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ Subversion checkouts are different: they mix the repository data in the working
|
||||
|
||||
You can also create branches using the Subversion bridge to GitHub.
|
||||
|
||||
From your svn client, make sure "master" is current by updating `trunk`:
|
||||
From your svn client, make sure the default branch is current by updating `trunk`:
|
||||
```shell
|
||||
$ svn up trunk
|
||||
> At revision 1.
|
||||
|
||||
@@ -35,9 +35,9 @@ Git projects are also stored within a single directory. However, Git obscures th
|
||||
A Git workflow looks like this:
|
||||
|
||||
* A Git repository stores the full history of all of its branches and tags within the *.git* directory.
|
||||
* The latest stable release is contained within the `master` branch.
|
||||
* The latest stable release is contained within the default branch.
|
||||
* Active feature work is developed in separate branches.
|
||||
* When a feature is finished, the feature branch is merged into `master` and deleted.
|
||||
* When a feature is finished, the feature branch is merged into the default branch and deleted.
|
||||
|
||||
Unlike SVN, with Git the directory structure remains the same, but the contents of the files change based on your branch.
|
||||
|
||||
|
||||
@@ -20,19 +20,19 @@ versions:
|
||||
|
||||
When viewing a file on {% data variables.product.product_location %}, you usually see the version at the current head of a branch. For example:
|
||||
|
||||
* [https://github.com/github/hubot/blob/**master**/README.md](https://github.com/github/hubot/blob/master/README.md)
|
||||
* [https://github.com/github/codeql/blob/**main**/README.md](https://github.com/github/codeql/blob/main/README.md)
|
||||
|
||||
refers to GitHub's `hubot` repository, and shows the `master` branch's current version of the `README.md` file.
|
||||
refers to GitHub's `codeql` repository, and shows the `main` branch's current version of the `README.md` file.
|
||||
|
||||
The version of a file at the head of branch can change as new commits are made, so if you were to copy the normal URL, the file contents might not be the same when someone looks at it later.
|
||||
|
||||
### Press <kbd>y</kbd> to permalink to a file in a specific commit
|
||||
|
||||
For a permanent link to the specific version of a file that you see, instead of using a branch name in the URL (i.e. the `master` part in the example above), put a commit id. This will permanently link to the exact version of the file in that commit. For example:
|
||||
For a permanent link to the specific version of a file that you see, instead of using a branch name in the URL (i.e. the `main` part in the example above), put a commit id. This will permanently link to the exact version of the file in that commit. For example:
|
||||
|
||||
* [https://github.com/github/hubot/blob/**ed25584f5ac2520a6c28547ffd0961c7abd7ea49**/README.md](https://github.com/github/hubot/blob/ed25584f5ac2520a6c28547ffd0961c7abd7ea49/README.md)
|
||||
* [https://github.com/github/codeql/blob/**b212af08a6cffbb434f3c8a2795a579e092792fd**/README.md](https://github.com/github/codeql/blob/b212af08a6cffbb434f3c8a2795a579e092792fd/README.md)
|
||||
|
||||
replaces `master` with a specific commit id and the file content will not change.
|
||||
replaces `main` with a specific commit id and the file content will not change.
|
||||
|
||||
Looking up the commit SHA by hand is inconvenient, however, so as a shortcut you can type <kbd>y</kbd> to automatically update the URL to the permalink version. Then you can copy the URL knowing that anyone you share it with will see exactly what you saw.
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@ versions:
|
||||
---
|
||||
|
||||
|
||||
The interactive features of the notebook, such as custom JavaScript plots, will not work in your repository on {% data variables.product.product_location %}. For an example, see [*Linking and Interactions.ipynb*](https://github.com/bokeh/bokeh-notebooks/blob/master/tutorial/06%20-%20Linking%20and%20Interactions.ipynb).
|
||||
The interactive features of the notebook, such as custom JavaScript plots, will not work in your repository on {% data variables.product.product_location %}. For an example, see [*Linking and Interactions.ipynb*](https://github.com/bokeh/bokeh-notebooks/blob/main/tutorial/06%20-%20Linking%20and%20Interactions.ipynb).
|
||||
|
||||
To view your Jupyter notebook with JavaScript content rendered or to share your notebook files with others you can use [nbviewer](https://nbviewer.jupyter.org/). For an example, see [*Linking and Interactions.ipynb*](https://nbviewer.jupyter.org/github/bokeh/bokeh-notebooks/blob/master/tutorial/06%20-%20Linking%20and%20Interactions.ipynb) rendered on nbviewer.
|
||||
To view your Jupyter notebook with JavaScript content rendered or to share your notebook files with others you can use [nbviewer](https://nbviewer.jupyter.org/). For an example, see [*Linking and Interactions.ipynb*](https://nbviewer.jupyter.org/github/bokeh/bokeh-notebooks/blob/main/tutorial/06%20-%20Linking%20and%20Interactions.ipynb) rendered on nbviewer.
|
||||
|
||||
To view a fully interactive version of your Jupyter Notebook, you can set up a notebook server locally. For more information, see [Jupyter's official documentation](http://jupyter.readthedocs.io/en/latest/index.html).
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ If there are existing files in your repository that you'd like to use {% data va
|
||||
5. Commit the file and push it to {% data variables.product.product_name %}:
|
||||
```shell
|
||||
$ git commit -m "add file.psd"
|
||||
$ git push origin master
|
||||
$ git push
|
||||
```
|
||||
You should see some diagnostic information about your file upload:
|
||||
```shell
|
||||
|
||||
@@ -24,9 +24,9 @@ If you create an invalid URL using query parameters, or if you don’t have the
|
||||
|
||||
Query parameter | Example
|
||||
--- | ---
|
||||
`body` | `https://github.com/octo-org/octo-repo/compare/master...pull-request-test?quick_pull=1&body=Fixes+the+problem.` creates a pull request, comparing the branches `master` and `pull-request-test`, with the comment "Fixes the problem" in the pull request body.
|
||||
`body` | `https://github.com/octo-org/octo-repo/compare/main...pull-request-test?quick_pull=1&body=Fixes+the+problem.` creates a pull request, comparing the branches `main` and `pull-request-test`, with the comment "Fixes the problem" in the pull request body.
|
||||
`title` | `https://github.com/octo-org/octo-repo/issues/new?labels=bug&title=New+bug+report` creates an issue with the label "bug" and title "New bug report."
|
||||
`labels` | `https://github.com/octo-org/octo-repo/compare/master...pull-request-test?quick_pull=1&labels=bug` creates a pull request, comparing the branches `master` and `pull-request-test`, with the label "bug."
|
||||
`labels` | `https://github.com/octo-org/octo-repo/compare/main...pull-request-test?quick_pull=1&labels=bug` creates a pull request, comparing the branches `main` and `pull-request-test`, with the label "bug."
|
||||
`template` | `https://github.com/octo-org/octo-repo/issues/new?template=issue_template.md` creates an issue with a template in the issue body.
|
||||
`milestone` | `https://github.com/octo-org/octo-repo/issues/new?milestone=testing+milestones` creates an issue with the milestone "testing milestones."
|
||||
`assignees` | `https://github.com/octo-org/octo-repo/issues/new?assignees=octocat` creates an issue and assigns it to @octocat.
|
||||
|
||||
@@ -17,7 +17,7 @@ You can link an issue to a pull request {% if currentVersion == "free-pro-team@l
|
||||
|
||||
When you link a pull request to the issue the pull request addresses, collaborators can see that someone is working on the issue. {% if currentVersion ver_lt "enterprise-server@2.21" %}If the pull request and the issue are in different repositories, {% data variables.product.product_name %} will display the link after the pull request is merged, if the person who merges the pull request also has permission to close the issue.{% endif %}
|
||||
|
||||
When you merge a linked pull request into the default branch of a repository, its linked issue is automatically closed. For more information about the default branch, see "[Setting the default branch](/github/administering-a-repository/setting-the-default-branch)."
|
||||
When you merge a linked pull request into the default branch of a repository, its linked issue is automatically closed. For more information about the default branch, see "[Changing the default branch](/github/administering-a-repository/changing-the-default-branch)."
|
||||
|
||||
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.20" %}
|
||||
### Manually linking a pull request to an issue
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
---
|
||||
title: Managing the default branch name for repositories in your organization
|
||||
intro: You can set the default branch name for repositories that members create in your organization.
|
||||
intro: 'You can set the default branch name for repositories that members create in your organization on {% data variables.product.product_location %}.'
|
||||
permissions: Organization owners can manage the default branch name for new repositories in the organization.
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '>=2.23'
|
||||
---
|
||||
|
||||
### About the default branch name
|
||||
### About management of the default branch name
|
||||
|
||||
When a member of your organization creates a new repository, {% data variables.product.prodname_dotcom %} will create a single branch and set it as the repository's default branch. {% data variables.product.prodname_dotcom %} currently names the default branch `master`, but you can set the default branch to be named anything that makes sense for your development environment.
|
||||
When a member of your organization creates a new repository in your organization, the repository contains one branch, which is the default branch. You can change the name that {% data variables.product.product_name %} uses for the default branch in new repositories that members of your organization create. For more information about the default branch, see "[About branches](/github/collaborating-with-issues-and-pull-requests/about-branches#about-the-default-branch)."
|
||||
|
||||
{% data reusables.branches.set-default-branch %}
|
||||
|
||||
{% data reusables.branches.rename-existing-branch %}
|
||||
{% data reusables.branches.change-default-branch %}
|
||||
|
||||
### Setting the default branch name
|
||||
|
||||
@@ -24,7 +23,7 @@ When a member of your organization creates a new repository, {% data variables.p
|
||||

|
||||
{% note %}
|
||||
|
||||
**Note:** If your enterprise owner has enforced a policy for the default name, you won't be able to change it here. You will be able to set the default branch on individual repositories. For more information, see "[Enforcing a policy on the default branch name](/github/setting-up-and-managing-your-enterprise-account/enforcing-repository-management-policies-in-your-enterprise-account#enforcing-a-policy-on-the-default-branch-name)" and "[Setting the default branch](/github/administering-a-repository/setting-the-default-branch)."
|
||||
**Note:** If your enterprise owner has enforced a policy for the default name, you won't be able to change it here. You will be able to set the default branch on individual repositories. For more information, see "[Enforcing a policy on the default branch name](/github/setting-up-and-managing-your-enterprise-account/enforcing-repository-management-policies-in-your-enterprise-account#enforcing-a-policy-on-the-default-branch-name)" and "[Changing the default branch](/github/administering-a-repository/changing-the-default-branch)."
|
||||
|
||||
{% endnote %}
|
||||
4. Type the default name that you would like to use for new branches.
|
||||
@@ -34,4 +33,4 @@ When a member of your organization creates a new repository, {% data variables.p
|
||||
|
||||
### Further reading
|
||||
|
||||
- [Managing the default branch name for your repositories](/github/setting-up-and-managing-your-github-user-account/managing-the-default-branch-name-for-your-repositories)
|
||||
- "[Managing the default branch name for your repositories](/github/setting-up-and-managing-your-github-user-account/managing-the-default-branch-name-for-your-repositories)"
|
||||
|
||||
@@ -70,6 +70,7 @@ Organization members can have *owner*{% if currentVersion == "free-pro-team@late
|
||||
| Convert organization members to [outside collaborators](#outside-collaborators) | **X** | | |
|
||||
| [View people with access to an organization repository](/articles/viewing-people-with-access-to-your-repository) | **X** | | |
|
||||
| [Export a list of people with access to an organization repository](/articles/viewing-people-with-access-to-your-repository/#exporting-a-list-of-people-with-access-to-your-repository) | **X** | | |
|
||||
| Manage the default branch name (see "[Managing the default branch name for repositories in your organization](/github/setting-up-and-managing-organizations-and-teams/managing-the-default-branch-name-for-repositories-in-your-organization)") | **X** | | |
|
||||
| Manage default labels (see "[Managing default labels for repositories in your organization](/articles/managing-default-labels-for-repositories-in-your-organization)") | **X** | | |
|
||||
| Enable team synchronization (see "[Managing team synchronization for your organization](/github/setting-up-and-managing-organizations-and-teams/managing-team-synchronization-for-your-organization)" for details) | **X** | | |
|
||||
|
||||
|
||||
@@ -202,7 +202,8 @@ For more information, see "[Restricting publication of {% data variables.product
|
||||
| `remove_outside_collaborator` | Triggered when an owner removes an outside collaborator from an organization or when [two-factor authentication is required in an organization](/articles/requiring-two-factor-authentication-in-your-organization) and an outside collaborator does not use 2FA or disables 2FA. |{% if currentVersion == "free-pro-team@latest" %}
|
||||
| `revoke_external_identity` | Triggered when an organization owner revokes a member's linked identity. For more information, see "[Viewing and managing a member's SAML access to your organization](/github/setting-up-and-managing-organizations-and-teams/viewing-and-managing-a-members-saml-access-to-your-organization#viewing-and-revoking-a-linked-identity)."
|
||||
| `revoke_sso_session` | Triggered when an organization owner revokes a member's SAML session. For more information, see "[Viewing and managing a member's SAML access to your organization](/github/setting-up-and-managing-organizations-and-teams/viewing-and-managing-a-members-saml-access-to-your-organization#viewing-and-revoking-a-linked-identity)."
|
||||
| `unblock_user` | Triggered when an organization owner [unblocks a user from an organization](/articles/unblocking-a-user-from-your-organization).{% endif %}
|
||||
| `unblock_user` | Triggered when an organization owner [unblocks a user from an organization](/articles/unblocking-a-user-from-your-organization).{% endif %}{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.22" %}
|
||||
| `update_new_repository_default_branch_setting` | Triggered when an owner changes the name of the default branch for new repositories in the organization. For more information, see "[Managing the default branch name for repositories in your organization](/github/setting-up-and-managing-organizations-and-teams/managing-the-default-branch-name-for-repositories-in-your-organization)."{% endif %}
|
||||
| `update_default_repository_permission` | Triggered when an owner changes the default repository permission level for organization members.
|
||||
| `update_member` | Triggered when an owner changes a person's role from owner to member or member to owner.
|
||||
| `update_member_repository_creation_permission` | Triggered when an owner changes the create repository permission for organization members.{% if currentVersion == "free-pro-team@latest" %}
|
||||
|
||||
@@ -67,7 +67,7 @@ Commits are only counted if they are made in the default branch or the `gh-pages
|
||||
|
||||
If your commits are in a non-default or non-`gh-pages` branch and you'd like them to count toward your contributions, you will need to do one of the following:
|
||||
- [Open a pull request](/articles/creating-a-pull-request) to have your changes merged into the default branch or the `gh-pages` branch.
|
||||
- [Change the default branch](/articles/setting-the-default-branch) of the repository.
|
||||
- [Change the default branch](/github/administering-a-repository/changing-the-default-branch) of the repository.
|
||||
|
||||
{% warning %}
|
||||
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
---
|
||||
title: Managing the default branch name for your repositories
|
||||
intro: You can set a default branch name for all new repositories that you create.
|
||||
intro: 'You can set the default branch name new repositories that you create on {% data variables.product.product_location %}.'
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '>=2.23'
|
||||
---
|
||||
|
||||
### About the default branch name
|
||||
### About management of the default branch name
|
||||
|
||||
{% data reusables.branches.new-repo-default-branch %} This branch is currently named `master`, but you can set the default branch name to anything that makes sense for your development environment.
|
||||
When you create a new repository on {% data variables.product.product_location %}, the repository contains one branch, which is the default branch. You can change the name that {% data variables.product.product_name %} uses for the default branch in new repositories you create. For more information about the default branch, see "[About branches](/github/collaborating-with-issues-and-pull-requests/about-branches#about-the-default-branch)."
|
||||
|
||||
{% data reusables.branches.set-default-branch %}
|
||||
|
||||
{% data reusables.branches.rename-existing-branch %}
|
||||
{% data reusables.branches.change-default-branch %}
|
||||
|
||||
### Setting the default branch name
|
||||
|
||||
@@ -27,4 +25,4 @@ versions:
|
||||
|
||||
### Further reading
|
||||
|
||||
- [Managing the default branch name for repositories in your organization](/github/setting-up-and-managing-organizations-and-teams/managing-the-default-branch-name-for-repositories-in-your-organization)
|
||||
- "[Managing the default branch name for repositories in your organization](/github/setting-up-and-managing-organizations-and-teams/managing-the-default-branch-name-for-repositories-in-your-organization)"
|
||||
|
||||
@@ -37,7 +37,7 @@ The best way to explain subtree merges is to show by example. We will:
|
||||
$ touch .gitignore
|
||||
$ git add .gitignore
|
||||
$ git commit -m "initial commit"
|
||||
> [master (root-commit) 3146c2a] initial commit
|
||||
> [main (root-commit) 3146c2a] initial commit
|
||||
> 0 files changed, 0 insertions(+), 0 deletions(-)
|
||||
> create mode 100644 .gitignore
|
||||
```
|
||||
@@ -55,29 +55,29 @@ The best way to explain subtree merges is to show by example. We will:
|
||||
> Receiving objects: 100% (1732/1732), 528.19 KiB | 621 KiB/s, done.
|
||||
> Resolving deltas: 100% (1086/1086), done.
|
||||
> From git://github.com/octocat/Spoon-Knife
|
||||
> * [new branch] master -> Spoon-Knife/master
|
||||
> * [new branch] main -> Spoon-Knife/main
|
||||
```
|
||||
2. Merge the `Spoon-Knife` project into the local Git project. This doesn't change any of your files locally, but it does prepare Git for the next step.
|
||||
|
||||
If you're using Git 2.9 or above:
|
||||
```shell
|
||||
$ git merge -s ours --no-commit --allow-unrelated-histories spoon-knife/master
|
||||
$ git merge -s ours --no-commit --allow-unrelated-histories spoon-knife/main
|
||||
> Automatic merge went well; stopped before committing as requested
|
||||
```
|
||||
|
||||
If you're using Git 2.8 or below:
|
||||
```shell
|
||||
$ git merge -s ours --no-commit spoon-knife/master
|
||||
$ git merge -s ours --no-commit spoon-knife/main
|
||||
> Automatic merge went well; stopped before committing as requested
|
||||
```
|
||||
3. Create a new directory called **spoon-knife**, and copy the Git history of the `Spoon-Knife` project into it.
|
||||
```shell
|
||||
$ git read-tree --prefix=spoon-knife/ -u spoon-knife/master
|
||||
$ git read-tree --prefix=spoon-knife/ -u spoon-knife/main
|
||||
```
|
||||
4. Commit the changes to keep them safe.
|
||||
```shell
|
||||
$ git commit -m "Subtree merged in spoon-knife"
|
||||
> [master fe0ca25] Subtree merged in spoon-knife
|
||||
> [main fe0ca25] Subtree merged in spoon-knife
|
||||
```
|
||||
|
||||
Although we've only added one subproject, any number of subprojects can be incorporated into a Git repository.
|
||||
@@ -99,7 +99,7 @@ $ git pull -s subtree <em>remotename</em> <em>branchname</em>
|
||||
For the example above, this would be:
|
||||
|
||||
```shell
|
||||
$ git pull -s subtree spoon-knife master
|
||||
$ git pull -s subtree spoon-knife main
|
||||
```
|
||||
|
||||
### Further reading
|
||||
|
||||
@@ -11,9 +11,9 @@ versions:
|
||||
If another person has pushed to the same branch as you, Git won't be able to push your changes:
|
||||
|
||||
```shell
|
||||
$ git push origin master
|
||||
$ git push origin main
|
||||
> To https://{% data variables.command_line.codeblock %}/<em>USERNAME</em>/<em>REPOSITORY</em>.git
|
||||
> ! [rejected] master -> master (non-fast-forward)
|
||||
> ! [rejected] main -> main (non-fast-forward)
|
||||
> error: failed to push some refs to 'https://{% data variables.command_line.codeblock %}/<em>USERNAME</em>/<em>REPOSITORY</em>.git'
|
||||
> To prevent you from losing history, non-fast-forward updates were rejected
|
||||
> Merge the remote changes (e.g. 'git pull') before pushing again. See the
|
||||
|
||||
@@ -12,7 +12,7 @@ versions:
|
||||
The `git push` command takes two arguments:
|
||||
|
||||
* A remote name, for example, `origin`
|
||||
* A branch name, for example, `master`
|
||||
* A branch name, for example, `main`
|
||||
|
||||
For example:
|
||||
|
||||
@@ -20,7 +20,7 @@ For example:
|
||||
git push <em> <REMOTENAME> <BRANCHNAME> </em>
|
||||
```
|
||||
|
||||
As an example, you usually run `git push origin master` to push your local changes
|
||||
As an example, you usually run `git push origin main` to push your local changes
|
||||
to your online repository.
|
||||
|
||||
### Renaming branches
|
||||
@@ -96,7 +96,7 @@ git fetch upstream
|
||||
> remote: Total 62 (delta 27), reused 44 (delta 9)
|
||||
> Unpacking objects: 100% (62/62), done.
|
||||
> From https://{% data variables.command_line.codeblock %}/<em>octocat</em>/<em>repo</em>
|
||||
> * [new branch] master -> upstream/master
|
||||
> * [new branch] main -> upstream/main
|
||||
```
|
||||
|
||||
When you're done making local changes, you can push your local branch to GitHub
|
||||
|
||||
@@ -33,7 +33,7 @@ If you create a new clone of the repository, you won't lose any of your Git hist
|
||||
{% endtip %}
|
||||
|
||||
{% endwindows %}
|
||||
- `BRANCH-NAME`: The default branch for your current project, for example, `master` or `gh-pages`.
|
||||
- `BRANCH-NAME`: The default branch for your current project, for example, `main` or `gh-pages`.
|
||||
```shell
|
||||
$ git filter-branch --prune-empty --subdirectory-filter <em>FOLDER-NAME BRANCH-NAME </em>
|
||||
# Filter the specified branch in your directory and remove empty commits
|
||||
|
||||
@@ -123,7 +123,7 @@ As before, Git is showing the commit message for you to edit. You can change the
|
||||
Since you've altered Git history, the usual `git push origin` **will not** work. You'll need to modify the command by "force-pushing" your latest changes:
|
||||
|
||||
```shell
|
||||
$ git push origin master --force
|
||||
$ git push origin main --force
|
||||
```
|
||||
|
||||
{% warning %}
|
||||
|
||||
Reference in New Issue
Block a user