summaryrefslogtreecommitdiff
path: root/doc/topics/git
diff options
context:
space:
mode:
Diffstat (limited to 'doc/topics/git')
-rw-r--r--doc/topics/git/how_to_install_git/index.md4
-rw-r--r--doc/topics/git/migrate_to_git_lfs/index.md16
-rw-r--r--doc/topics/git/numerous_undo_possibilities_in_git/index.md2
-rw-r--r--doc/topics/git/partial_clone.md8
-rw-r--r--doc/topics/git/troubleshooting_git.md6
-rw-r--r--doc/topics/git/useful_git_commands.md50
6 files changed, 43 insertions, 43 deletions
diff --git a/doc/topics/git/how_to_install_git/index.md b/doc/topics/git/how_to_install_git/index.md
index db474559627..2c3cd61f050 100644
--- a/doc/topics/git/how_to_install_git/index.md
+++ b/doc/topics/git/how_to_install_git/index.md
@@ -46,7 +46,7 @@ for the official Homebrew installation instructions.
With Homebrew installed you are now ready to install Git.
Open a Terminal and enter in the following command:
-```sh
+```shell
brew install git
```
@@ -62,7 +62,7 @@ it is recommended to use the built in package manager to install Git.
Open a Terminal and enter in the following commands
to install the latest Git from the official Git maintained package archives:
-```sh
+```shell
sudo apt-add-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git
diff --git a/doc/topics/git/migrate_to_git_lfs/index.md b/doc/topics/git/migrate_to_git_lfs/index.md
index eec1c3c10c1..9c73b4dfde7 100644
--- a/doc/topics/git/migrate_to_git_lfs/index.md
+++ b/doc/topics/git/migrate_to_git_lfs/index.md
@@ -49,13 +49,13 @@ To follow this tutorial, you'll need:
(Java 7 or above) installed locally.
- BFG installed locally:
- ```bash
+ ```shell
brew install bfg
```
- Git LFS installed locally:
- ```bash
+ ```shell
brew install git-lfs
```
@@ -80,13 +80,13 @@ Consider an example upstream project, `git@gitlab.com:gitlab-tests/test-git-lfs-
(in our example, `test-git-lfs-repo-migration.git`),
mirroring the upstream project:
- ```bash
+ ```shell
git clone --mirror git@gitlab.com:gitlab-tests/test-git-lfs-repo-migration.git
```
1. Convert the Git history with BFG:
- ```bash
+ ```shell
bfg --convert-to-git-lfs "*.{png,mp4,jpg,gif}" --no-blob-protection test-git-lfs-repo-migration.git
```
@@ -95,7 +95,7 @@ Consider an example upstream project, `git@gitlab.com:gitlab-tests/test-git-lfs-
1. Clean up the repository:
- ```bash
+ ```shell
# cd path/to/mirror/repo:
cd test-git-lfs-repo-migration.git
# clean up the repo:
@@ -107,7 +107,7 @@ Consider an example upstream project, `git@gitlab.com:gitlab-tests/test-git-lfs-
1. Install Git LFS in the mirror repository:
- ```bash
+ ```shell
git lfs install
```
@@ -121,13 +121,13 @@ Consider an example upstream project, `git@gitlab.com:gitlab-tests/test-git-lfs-
1. Force-push to GitLab:
- ```bash
+ ```shell
git push --force
```
1. Track the files you want with LFS:
- ```bash
+ ```shell
# cd path/to/upstream/repo:
cd test-git-lfs-repo-migration
# You may need to reset your local copy with upstream's `master` after force-pushing from the mirror:
diff --git a/doc/topics/git/numerous_undo_possibilities_in_git/index.md b/doc/topics/git/numerous_undo_possibilities_in_git/index.md
index 33da01d35b8..cea052f3a90 100644
--- a/doc/topics/git/numerous_undo_possibilities_in_git/index.md
+++ b/doc/topics/git/numerous_undo_possibilities_in_git/index.md
@@ -161,7 +161,7 @@ of the staging tree. You also have an option to discard all changes with
Lets start the example by editing a file, with your favorite editor, to change the
content and add it to staging
-```sh
+```shell
vim <file>
git add <file>
```
diff --git a/doc/topics/git/partial_clone.md b/doc/topics/git/partial_clone.md
index e6f84ee8251..83f1d0f0de5 100644
--- a/doc/topics/git/partial_clone.md
+++ b/doc/topics/git/partial_clone.md
@@ -44,7 +44,7 @@ Follow [Git for enormous repositories](https://gitlab.com/groups/gitlab-org/-/ep
To enable partial clone, use the [feature flags API](../../api/features.md).
For example:
-```sh
+```shell
curl --data "value=true" --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/features/gitaly_upload_pack_filter
```
@@ -64,7 +64,7 @@ partial clone, all files – large or small – may be treated the same.
With the `uploadpack.allowFilter` and `uploadpack.allowAnySHA1InWant` options
enabled on the Git server:
-```bash
+```shell
# clone the repo, excluding blobs larger than 1 megabyte
git clone --filter=blob:limit=1m <url>
@@ -109,7 +109,7 @@ enabled on the Git server:
[issue tracking support for `--filter=sparse:oid`](https://gitlab.com/gitlab-org/git/issues/4)
for updates.
- ```bash
+ ```shell
# Create a new directory for the Git repository
mkdir jumbo-repo && cd jumbo-repo
@@ -140,7 +140,7 @@ enabled on the Git server:
other paths being downloaded automatically when checking out branches. Follow
[issue proposing automating sparse checkouts](https://gitlab.com/gitlab-org/git/issues/5) for updates.
- ```bash
+ ```shell
# Enable sparse checkout
git config --local core.sparsecheckout true
diff --git a/doc/topics/git/troubleshooting_git.md b/doc/topics/git/troubleshooting_git.md
index d4d559c9483..446c2c0db4c 100644
--- a/doc/topics/git/troubleshooting_git.md
+++ b/doc/topics/git/troubleshooting_git.md
@@ -30,7 +30,7 @@ Example of an error during a clone:
Open a terminal and enter:
-```sh
+```shell
git config http.postBuffer 52428800
```
@@ -78,7 +78,7 @@ ClientAliveCountMax 5
**If 'pack-objects' type errors are also being displayed**, you can try to
run a `git repack` before attempting to push to the remote repository again:
-```sh
+```shell
git repack
git push
```
@@ -146,7 +146,7 @@ This can be fixed by increasing the existing `http.postBuffer` value to one grea
NOTE: **Note:**
The default value of `http.postBuffer`, 1 MiB, is applied if the setting is not configured.
-```sh
+```shell
git config http.postBuffer 524288000
```
diff --git a/doc/topics/git/useful_git_commands.md b/doc/topics/git/useful_git_commands.md
index 68b4c772b8b..2cec0cd04f7 100644
--- a/doc/topics/git/useful_git_commands.md
+++ b/doc/topics/git/useful_git_commands.md
@@ -11,7 +11,7 @@ need to use often, but they can can come in handy when needed.
### Add another URL to a remote, so both remotes get updated on each push
-```sh
+```shell
git remote set-url --add <remote_name> <remote_url>
```
@@ -19,7 +19,7 @@ git remote set-url --add <remote_name> <remote_url>
### Remove last commit and leave the changes in unstaged
-```sh
+```shell
git reset --soft HEAD^
```
@@ -27,13 +27,13 @@ git reset --soft HEAD^
To unstage 3 commits, for example, run:
-```sh
+```shell
git reset HEAD^3
```
### Unstage changes to a certain file from HEAD
-```sh
+```shell
git reset <filename>
```
@@ -46,19 +46,19 @@ There are two options to revert changes to a file:
### Undo a previous commit by creating a new replacement commit
-```sh
+```shell
git revert <commit-sha>
```
### Create a new message for last commit
-```sh
+```shell
git commit --amend
```
### Add a file to the last commit
-```sh
+```shell
git add <filename>
git commit --amend
```
@@ -70,31 +70,31 @@ message.
### Stash changes
-```sh
+```shell
git stash save
```
The default behavior of `stash` is to save, so you can also use just:
-```sh
+```shell
git stash
```
### Unstash your changes
-```sh
+```shell
git stash apply
```
### Discard your stashed changes
-```sh
+```shell
git stash drop
```
### Apply and drop your stashed changes
-```sh
+```shell
git stash pop
```
@@ -102,7 +102,7 @@ git stash pop
### Use reflog to show the log of reference changes to HEAD
-```sh
+```shell
git reflog
```
@@ -110,7 +110,7 @@ git reflog
The basic command to check the Git history of a file:
-```sh
+```shell
git log <file>
```
@@ -123,25 +123,25 @@ Use '--' to separate paths from revisions, like this:
Use this to check the Git history of the file:
-```sh
+```shell
git log -- <file>
```
### Find the tags that contain a particular SHA
-```sh
+```shell
git tag --contains <sha>
```
### Check the content of each change to a file
-```sh
+```shell
gitk <file>
```
### Check the content of each change to a file, follows it past file renames
-```sh
+```shell
gitk --follow <file>
```
@@ -149,7 +149,7 @@ gitk --follow <file>
### Use a custom SSH key for a Git command
-```sh
+```shell
GIT_SSH_COMMAND="ssh -i ~/.ssh/gitlabadmin" git <command>
```
@@ -157,13 +157,13 @@ GIT_SSH_COMMAND="ssh -i ~/.ssh/gitlabadmin" git <command>
With SSH:
-```sh
+```shell
GIT_SSH_COMMAND="ssh -vvv" git clone <git@url>
```
With HTTPS:
-```sh
+```shell
GIT_TRACE_PACKET=1 GIT_TRACE=2 GIT_CURL_VERBOSE=1 git clone <url>
```
@@ -181,13 +181,13 @@ Git includes a complete set of [traces for debugging Git commands](https://git-s
The -i flag stands for 'interactive':
-```sh
+```shell
git rebase -i master
```
### Continue the rebase if paused
-```sh
+```shell
git rebase --continue
```
@@ -195,13 +195,13 @@ git rebase --continue
To _reuse_ recorded solutions to the same problems when repeated:
-```sh
+```shell
git rerere
```
To enable `rerere` functionality:
-```sh
+```shell
git config --global rerere.enabled true
```