You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: book/A-git-in-other-environments/sections/bash.asc
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,9 +8,9 @@ First, you need to get a copy of the `contrib/completion/git-completion.bash` fi
8
8
Copy it somewhere handy, like your home directory, and add this to your `.bashrc`:
9
9
10
10
[source,console]
11
-
-----
11
+
----
12
12
. ~/git-completion.bash
13
-
-----
13
+
----
14
14
15
15
Once that's done, change your directory to a Git repository, and type:
16
16
@@ -27,11 +27,11 @@ This can be as simple or complex as you want, but there are generally a few key
27
27
To add these to your prompt, just copy the `contrib/completion/git-prompt.sh` file from Git's source repository to your home directory, add something like this to your `.bashrc`:
28
28
29
29
[source,console]
30
-
-----
30
+
----
31
31
. ~/git-prompt.sh
32
32
export GIT_PS1_SHOWDIRTYSTATE=1
33
33
export PS1='\w$(__git_ps1 " (%s)")\$ '
34
-
-----
34
+
----
35
35
36
36
The `\w` means print the current working directory, the `\$` prints the `$` part of the prompt, and `__git_ps1 " (%s)"` calls the function provided by `git-prompt.sh` with a formatting argument.
37
37
Now your bash prompt will look like this when you're anywhere inside a Git-controlled project:
Pluggable storage provides many interesting options.
54
54
For instance, https://github.com/go-git/go-git/tree/master/_examples/storage[] allows you to store references, objects, and configuration in an Aerospike database.
@@ -59,7 +59,7 @@ Using https://pkg.go.dev/github.com/go-git/go-billy/v5?tab=doc#Filesystem[] it i
59
59
Another advanced use-case includes a fine-tunable HTTP client, such as the one found at https://github.com/go-git/go-git/blob/master/_examples/custom_http/main.go[].
60
60
61
61
[source, go]
62
-
-----
62
+
----
63
63
customClient := &http.Client{
64
64
Transport: &http.Transport{ // accept any certificate (might be useful for testing)
0 commit comments