updating content files
This commit is contained in:
@@ -24,7 +24,7 @@ Typically, you would use `git rebase` to:
|
||||
|
||||
{% endwarning %}
|
||||
|
||||
### Rebasing commits against a branch
|
||||
## Rebasing commits against a branch
|
||||
|
||||
To rebase all the commits between another branch and the current branch state, you can enter the following command in your shell (either the command prompt for Windows, or the terminal for Mac and Linux):
|
||||
|
||||
@@ -32,7 +32,7 @@ To rebase all the commits between another branch and the current branch state, y
|
||||
$ git rebase --interactive <em>other_branch_name</em>
|
||||
```
|
||||
|
||||
### Rebasing commits against a point in time
|
||||
## Rebasing commits against a point in time
|
||||
|
||||
To rebase the last few commits in your current branch, you can enter the following command in your shell:
|
||||
|
||||
@@ -40,7 +40,7 @@ To rebase the last few commits in your current branch, you can enter the followi
|
||||
$ git rebase --interactive HEAD~7
|
||||
```
|
||||
|
||||
### Commands available while rebasing
|
||||
## Commands available while rebasing
|
||||
|
||||
There are six commands available while rebasing:
|
||||
|
||||
@@ -64,7 +64,7 @@ There are six commands available while rebasing:
|
||||
<dd>This lets you run arbitrary shell commands against a commit.</dd>
|
||||
</dl>
|
||||
|
||||
### An example of using `git rebase`
|
||||
## An example of using `git rebase`
|
||||
|
||||
No matter which command you use, Git will launch [your default text editor](/github/getting-started-with-github/associating-text-editors-with-git) and open a file that details the commits in the range you've chosen. That file looks something like this:
|
||||
|
||||
@@ -100,7 +100,7 @@ Breaking this information, from top to bottom, we see that:
|
||||
- After the commits, Git tells you the range of commits we're working with (`41a72e6..7b36971`).
|
||||
- Finally, Git gives some help by telling you the commands that are available to you when rebasing commits.
|
||||
|
||||
### Further reading
|
||||
## Further reading
|
||||
|
||||
- "[Using Git rebase](/articles/using-git-rebase)"
|
||||
- [The "Git Branching" chapter from the _Pro Git_ book](https://git-scm.com/book/en/Git-Branching-Rebasing)
|
||||
|
||||
@@ -12,7 +12,7 @@ versions:
|
||||
enterprise-server: '*'
|
||||
github-ae: '*'
|
||||
---
|
||||
### About subtree merges
|
||||
## About subtree merges
|
||||
|
||||
Typically, a subtree merge is used to contain a repository within a repository. The "subrepository" is stored in a folder of the main repository.
|
||||
|
||||
@@ -23,7 +23,7 @@ The best way to explain subtree merges is to show by example. We will:
|
||||
- The `test` project will use that subproject as if it were part of the same repository.
|
||||
- Fetch updates from `Spoon-Knife` into our `test` project.
|
||||
|
||||
### Setting up the empty repository for a subtree merge
|
||||
## Setting up the empty repository for a subtree merge
|
||||
|
||||
{% data reusables.command_line.open_the_multi_os_terminal %}
|
||||
2. Create a new directory and navigate to it.
|
||||
@@ -46,7 +46,7 @@ The best way to explain subtree merges is to show by example. We will:
|
||||
> create mode 100644 .gitignore
|
||||
```
|
||||
|
||||
### Adding a new repository as a subtree
|
||||
## Adding a new repository as a subtree
|
||||
|
||||
1. Add a new remote URL pointing to the separate project that we're interested in.
|
||||
```shell
|
||||
@@ -92,7 +92,7 @@ Although we've only added one subproject, any number of subprojects can be incor
|
||||
|
||||
{% endtip %}
|
||||
|
||||
### Synchronizing with updates and changes
|
||||
## Synchronizing with updates and changes
|
||||
|
||||
When a subproject is added, it is not automatically kept in sync with the upstream changes. You will need to update the subproject with the following command:
|
||||
|
||||
@@ -106,7 +106,7 @@ For the example above, this would be:
|
||||
$ git pull -s subtree spoon-knife main
|
||||
```
|
||||
|
||||
### Further reading
|
||||
## Further reading
|
||||
|
||||
- [The "Advanced Merging" chapter from the _Pro Git_ book](https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging)
|
||||
- "[How to use the subtree merge strategy](https://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html)"
|
||||
|
||||
@@ -11,11 +11,11 @@ versions:
|
||||
enterprise-server: '*'
|
||||
github-ae: '*'
|
||||
---
|
||||
### Options for getting changes
|
||||
## Options for getting changes
|
||||
|
||||
These commands are very useful when interacting with [a remote repository](/github/getting-started-with-github/about-remote-repositories). `clone` and `fetch` download remote code from a repository's remote URL to your local computer, `merge` is used to merge different people's work together with yours, and `pull` is a combination of `fetch` and `merge`.
|
||||
|
||||
### Cloning a repository
|
||||
## Cloning a repository
|
||||
|
||||
To grab a complete copy of another user's repository, use `git clone` like this:
|
||||
|
||||
@@ -39,7 +39,7 @@ For every branch `foo` in the remote repository, a corresponding remote-tracking
|
||||
`refs/remotes/origin/foo` is created in your local repository. You can usually abbreviate
|
||||
such remote-tracking branch names to `origin/foo`.
|
||||
|
||||
### Fetching changes from a remote repository
|
||||
## Fetching changes from a remote repository
|
||||
|
||||
Use `git fetch` to retrieve new work done by other people. Fetching from a repository grabs all the new remote-tracking branches and tags *without* merging those changes into your own branches.
|
||||
|
||||
@@ -52,7 +52,7 @@ $ git fetch <em>remotename</em>
|
||||
|
||||
Otherwise, you can always add a new remote and then fetch. For more information, see "[Managing remote repositories](/github/getting-started-with-github/managing-remote-repositories)."
|
||||
|
||||
### Merging changes into your local branch
|
||||
## Merging changes into your local branch
|
||||
|
||||
Merging combines your local changes with changes made by others.
|
||||
|
||||
@@ -63,7 +63,7 @@ $ git merge <em>remotename</em>/<em>branchname</em>
|
||||
# Merges updates made online with your local work
|
||||
```
|
||||
|
||||
### Pulling changes from a remote repository
|
||||
## Pulling changes from a remote repository
|
||||
|
||||
`git pull` is a convenient shortcut for completing both `git fetch` and `git merge `in the same command:
|
||||
|
||||
@@ -78,7 +78,7 @@ your local work is committed before running the `pull` command. If you run into
|
||||
you cannot resolve, or if you decide to quit the merge, you can use `git merge --abort`
|
||||
to take the branch back to where it was in before you pulled.
|
||||
|
||||
### Further reading
|
||||
## Further reading
|
||||
|
||||
- ["Working with Remotes" from the _Pro Git_ book](https://git-scm.com/book/en/Git-Basics-Working-with-Remotes)"{% if currentVersion == "free-pro-team@latest" %}
|
||||
- "[Troubleshooting connectivity problems](/articles/troubleshooting-connectivity-problems)"{% endif %}
|
||||
|
||||
@@ -25,7 +25,7 @@ git push <em> <REMOTENAME> <BRANCHNAME> </em>
|
||||
As an example, you usually run `git push origin main` to push your local changes
|
||||
to your online repository.
|
||||
|
||||
### Renaming branches
|
||||
## Renaming branches
|
||||
|
||||
To rename a branch, you'd use the same `git push` command, but you would add
|
||||
one more argument: the name of the new branch. For example:
|
||||
@@ -36,7 +36,7 @@ git push <em> <REMOTENAME> <LOCALBRANCHNAME></em>:<em><REMOTEBRANCHNAME
|
||||
|
||||
This pushes the `LOCALBRANCHNAME` to your `REMOTENAME`, but it is renamed to `REMOTEBRANCHNAME`.
|
||||
|
||||
### Dealing with "non-fast-forward" errors
|
||||
## Dealing with "non-fast-forward" errors
|
||||
|
||||
If your local copy of a repository is out of sync with, or "behind," the upstream
|
||||
repository you're pushing to, you'll get a message saying `non-fast-forward updates were rejected`.
|
||||
@@ -45,7 +45,7 @@ you are able to push your local changes.
|
||||
|
||||
For more information on this error, see "[Dealing with non-fast-forward errors](/github/getting-started-with-github/dealing-with-non-fast-forward-errors)."
|
||||
|
||||
### Pushing tags
|
||||
## Pushing tags
|
||||
|
||||
By default, and without additional parameters, `git push` sends all matching branches
|
||||
that have the same names as remote branches.
|
||||
@@ -62,7 +62,7 @@ To push all your tags, you can type the command:
|
||||
git push <em> <REMOTENAME></em> --tags
|
||||
```
|
||||
|
||||
### Deleting a remote branch or tag
|
||||
## Deleting a remote branch or tag
|
||||
|
||||
The syntax to delete a branch is a bit arcane at first glance:
|
||||
|
||||
@@ -75,7 +75,7 @@ you'd take to rename a branch. However, here, you're telling Git to push _nothin
|
||||
into `BRANCHNAME` on `REMOTENAME`. Because of this, `git push` deletes the branch
|
||||
on the remote repository.
|
||||
|
||||
### Remotes and forks
|
||||
## Remotes and forks
|
||||
|
||||
You might already know that [you can "fork" repositories](https://guides.github.com/overviews/forking/) on GitHub.
|
||||
|
||||
@@ -106,7 +106,7 @@ and [initiate a pull request](/articles/about-pull-requests).
|
||||
|
||||
For more information on working with forks, see "[Syncing a fork](/articles/syncing-a-fork)".
|
||||
|
||||
### Further reading
|
||||
## Further reading
|
||||
|
||||
- [The "Remotes" chapter from the "Pro Git" book](https://git-scm.com/book/ch5-2.html)
|
||||
- [`git remote` man page](https://git-scm.com/docs/git-remote.html)
|
||||
|
||||
@@ -11,7 +11,7 @@ versions:
|
||||
enterprise-server: '*'
|
||||
github-ae: '*'
|
||||
---
|
||||
### Using Git rebase
|
||||
## Using Git rebase
|
||||
|
||||
In this example, we will cover all of the `git rebase` commands available, except for `exec`.
|
||||
|
||||
@@ -122,7 +122,7 @@ i cant' typ goods
|
||||
|
||||
As before, Git is showing the commit message for you to edit. You can change the text (`"i cant' typ goods"`), save the file, and close the editor. Git will finish the rebase and return you to the terminal.
|
||||
|
||||
### Pushing rebased code to GitHub
|
||||
## Pushing rebased code to GitHub
|
||||
|
||||
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:
|
||||
|
||||
@@ -140,6 +140,6 @@ Force pushing has serious implications because it changes the historical sequenc
|
||||
|
||||
{% endwarning %}
|
||||
|
||||
### Further reading
|
||||
## Further reading
|
||||
|
||||
* "[Resolving merge conflicts after a Git rebase](/github/getting-started-with-github/resolving-merge-conflicts-after-a-git-rebase)"
|
||||
|
||||
Reference in New Issue
Block a user