GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

Embed Notice

HTML Code

Corresponding Notice

  1. Embed this notice
    zunda (zundan@mastodon.zunda.ninja)'s status on Thursday, 21-Dec-2023 10:22:06 JSTzundazunda
    in reply to
    • かき@GNUsocialJP

    僕の使っているコマンドラインツールの #ひかえめなアドベントカレンダー2023 12月20日分はgitです。コードやテキストの変更を管理します。

    この余白はgitそのものの利用手順を書くには狭すぎるので置いておくとして、ワーキングコピーでシェルのプロンプトにワーキングコピーの状態を知らせてもらえると、未コミットの変更や未pushのコミットがあると*や>が見えて不安にさせてもらえるのがすごく便利です。

    Xubuntuではbashを使っていて、~/.bashrcに下記のような行を追加してあります。

    case "$TERM" in
    xterm*|rxvt*)
    if type __git_ps1 >/dev/null 2>&1; then
    GIT_PS1_SHOWDIRTYSTATE=true
    GIT_PS1_SHOWUPSTREAM="auto"
    PS1="${PS1/\\$ /}\$(__git_ps1)\$ "
    fi
    PS1=${PS1/\$ /\\n$ }
    ;;
    *)
    ;;
    esac

    macOSではzshを使っていて、~/.zshrcに下記のような行を追加してあります。.git-sh-promptファイルはUbuntuの/usr/lib/git-core/git-sh-promptをコピーしてきたものです。https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh と同様の内容です。

    source ~/.git-sh-prompt
    GIT_PS1_SHOWDIRTYSTATE=true
    GIT_PS1_SHOWUPSTREAM="auto"
    NEWLINE=$'\n'
    setopt PROMPT_SUBST
    PS1='%F{green}%n@%m%f:%F{cyan}%~%f $(__git_ps1)${NEWLINE}$ '

    例えばMastodonのワーキングコピーに居ると下記のようなプロンプトになります。=ならローカルに変更はなくoriginと同期されていてあんしん。

    zunda@misoan:~/c/src/github.com/zunda/mastodon (use-ruby33-react-router-5=)
    $

    In conversationThursday, 21-Dec-2023 10:22:06 JST from mastodon.zunda.ninjapermalink
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.