-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: write documentation for release 0.4.0 (#85)
- Loading branch information
1 parent
5159969
commit c4b6bad
Showing
8 changed files
with
240 additions
and
12 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
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
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,126 @@ | ||
--- | ||
icon: material/keyboard-settings-outline | ||
status: new | ||
title: Managing your git config | ||
description: Get and set your local git repository config | ||
--- | ||
|
||
# Managing your git config | ||
|
||
[:simple-git:{ .git-icon } Git Documentation](https://git-scm.com/docs/git-config) | :material-beaker-outline: Experimental | ||
|
||
Manage settings within your local git config, changing the behavior of the git client. | ||
|
||
## Retrieve a local setting :material-new-box:{.new-feature title="Feature added on the 31st March of 2023"} | ||
|
||
Providing a valid path to `Config` will retrieve all values associated with a setting in modification order. | ||
|
||
```{ .go .select linenums="1" } | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
|
||
git "github.com/purpleclay/gitz" | ||
) | ||
|
||
func main() { | ||
client, _ := git.NewClient() | ||
// setting user.name to purpleclay to cover up real identity | ||
|
||
cfg, err := client.Config("user.name") | ||
if err != nil { | ||
log.Fatal("failed to retrieve config setting") | ||
} | ||
|
||
for _, v := range cfg { | ||
fmt.Println(v) | ||
} | ||
} | ||
``` | ||
|
||
The values for the config setting would be: | ||
|
||
```{ .text .no-select .no-copy } | ||
purpleclay | ||
**** | ||
``` | ||
|
||
## Retrieve a batch of local settings :material-new-box:{.new-feature title="Feature added on the 31st March of 2023"} | ||
|
||
For convenience, multiple local settings can be retrieved in a batch using `ConfigL`. A partial batch is not supported and will fail if any setting does not exist. | ||
|
||
```{ .go .select linenums="1" } | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
|
||
git "github.com/purpleclay/gitz" | ||
) | ||
|
||
func main() { | ||
client, _ := git.NewClient() | ||
cfg, err := client.ConfigL("user.name", "user.email") | ||
if err != nil { | ||
log.Fatal("failed to retrieve config settings") | ||
} | ||
|
||
fmt.Println(cfg["user.name"][0]) | ||
fmt.Println(cfg["user.email"][0]) | ||
} | ||
``` | ||
|
||
The value for each config setting would be: | ||
|
||
```{ .text .no-select .no-copy } | ||
purpleclay | ||
********************** | ||
``` | ||
|
||
## Update a local setting :material-new-box:{.new-feature title="Feature added on the 31st March of 2023"} | ||
|
||
To update a local git setting, call `ConfigSet`` with a path and corresponding value. | ||
|
||
```{ .go .select linenums="1" } | ||
package main | ||
|
||
import ( | ||
"log" | ||
|
||
git "github.com/purpleclay/gitz" | ||
) | ||
|
||
func main() { | ||
client, _ := git.NewClient() | ||
err := client.ConfigSet("custom.setting", "value") | ||
if err != nil { | ||
log.Fatal("failed to set config setting") | ||
} | ||
} | ||
``` | ||
|
||
## Updating a batch of local settings :material-new-box:{.new-feature title="Feature added on the 31st March of 2023"} | ||
|
||
Multiple local settings can be updated in a batch using `ConfigSetL`. Pre-validation of config paths improves the chance of a successful update, but a partial batch may occur upon failure. | ||
|
||
```{ .go .select linenums="1" } | ||
package main | ||
|
||
import ( | ||
"log" | ||
|
||
git "github.com/purpleclay/gitz" | ||
) | ||
|
||
func main() { | ||
client, _ := git.NewClient() | ||
err := client.ConfigSetL("custom.setting1", "value", | ||
"custom.setting2", "value") | ||
if err != nil { | ||
log.Fatal("failed to set config setting") | ||
} | ||
} | ||
``` |
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
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
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
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
--- | ||
icon: material/test-tube | ||
status: new | ||
title: Testing your interactions with git | ||
description: A dedicated package for testing your interactions with git | ||
--- | ||
|
@@ -74,6 +75,20 @@ ci: include github release workflow` | |
} | ||
``` | ||
|
||
#### Multi-line commits :material-new-box:{.new-feature title="Feature added on the 31st March of 2023"} | ||
|
||
Import multi-line commits by prefixing each commit with a `>` token. The expected format is equivalent to the output from the git command: | ||
|
||
`git log --pretty='format:> %d %s%+b%-N'` | ||
|
||
```{ .text .no-select .no-copy } | ||
> (tag: 0.1.0, main, origin/main) feat: multi-line commits is supported | ||
> feat(deps): bump github.com/stretchr/testify from 1.8.1 to 1.8.2 | ||
Signed-off-by: dependabot[bot] <[email protected]> | ||
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> | ||
``` | ||
|
||
### With a remote log | ||
|
||
Initialize the remote origin of a repository with a predefined log using the `WithRemoteLog` option. Ideal for simulating a delta between the current log and its remote counterpart. | ||
|
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