Skip to content

Commit

Permalink
✨ Git pull & push alias.
Browse files Browse the repository at this point in the history
  • Loading branch information
92thunder committed May 28, 2024
1 parent e1f934c commit ffd3d02
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
31 changes: 31 additions & 0 deletions posts/2024-05-27.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
git で現在のローカルブランチの内容をリモートの同名ブランチに pull & push する方法のメモ。

---

## コマンドの調査

Git の CUI 操作は苦ではないが、ブランチ名を毎回入力するのは時間がかかるのでブランチ名を入力しなくて済むコマンドを調べた

```sh
# pull
git pull origin $(git branch --show-current)

# push
git push origin HEAD
```

このまま使うと長いので、alias を設定した。fish の設定例。

```config
abbr --add gpb 'git pull origin $(git branch --show-current)'
abbr --add gph 'git push origin HEAD'
```

## `abbr` について

abbr を設定したことがなかったのでメモ

- abbr は abbreviations(略語という意味)の省略語
- Enter キーやスペースキーで元のコマンドが展開されるので、`history` でコマンドの実行履歴を見た時に git などで検索しやすい

[https://fishshell.com/docs/current/cmds/abbr.html](https://fishshell.com/docs/current/cmds/abbr.html)
7 changes: 7 additions & 0 deletions posts/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ type ExternalPostInfo = {
type PostInfo = BlogPostInfo | ExternalPostInfo

export const postsInfo: PostInfo[] = [
{
id: "git-pull-push-alias",
mdFilename: "2024-05-28.md",
publishedAt: "2024-05-28 00:00:00",
title: "git pull, push のエイリアスを設定する",
type: "blog",
},
{
id: "dev-ops-days-tokyo-2024",
mdFilename: "2024-04-23.md",
Expand Down

0 comments on commit ffd3d02

Please sign in to comment.