Fix some discrepancies in existing git stories

This commit is contained in:
Angelos Chalaris
2023-05-25 23:18:31 +03:00
parent 1126305e42
commit 9eefafd90c
2 changed files with 9 additions and 3 deletions

View File

@ -10,11 +10,17 @@ excerpt: Effortlessly create upstream branches on push by enabling a simple git
dateModified: 2023-05-21T05:00:00-04:00
---
Manually creating upstream branches on push can be a tedious task. Luckily, Git provides a way to automate this process. You can use `git config` to enable automatic upstream branch creation on push:
Manually creating upstream branches on push can be a tedious task. Luckily, Git provides a way to automate this process. You can use `git config` to enable **automatic upstream branch creation on push**:
```shell
git config [--global] --add --bool push.autoSetupRemote true
# Syntax: git config [--global] --add --bool push.autoSetupRemote true
git config --global --add --bool push.autoSetupRemote true
# `git push` will automatically create new branches, if they don't exist
git checkout -b my-branch
git push
# Pushes to origin/my-branch
```
Using `push.autoSetupRemote` will automatically create a new branch on the remote repository, if it doesn't exist. Workflows that benefit most from this setup are ones where local branches are expected to have the same name as their remote counterparts. You can use the `--global` flag to enable this setting globally on your machine.

View File

@ -10,7 +10,7 @@ excerpt: Learn how to view your "undo" history using git reflog and reset your r
dateModified: 2023-05-21T21:10:59+03:00
---
Sometimes, `git log` doesn't cut it, especially for commands that don't show up in your commit history. Fortunately, there's a way to view your "undo" history. `reflog` is basically your safety net after running "scary" commands like `git rebase`. It allows you to see not only the commits you made, but each of the actions that led you there.
Sometimes, `git log` doesn't cut it, especially for commands that don't show up in your commit history. Fortunately, there's a way to view your **"undo" history**. `reflog` is basically your safety net after running "scary" commands like `git rebase`. It allows you to see not only the commits you made, but each of the actions that led you there.
To view you "undo" history, you can use `git reflog`, which displays the git reference log: