Help us understand the problem. What is going on with this article?

git pullしてきたときに "git pull origin 自分のいるブランチ" するコマンド

More than 3 years have passed since last update.

適当に pull と push を作りました。
pushについてはy/nとかつけたほうが良さそうな気もしますが、今はつけてないです

~/.bash_profule
git_branch() {
  echo $(git branch --no-color 2>/dev/null | sed -ne "s/^\* \(.*\)$/\1/p")
}
alias pull='git pull origin `echo $(git_branch)`'
alias push='git push origin `echo $(git_branch)`'

git_branch()はechoで今いるブランチを出力するだけの関数で、これをgit pull originに足してあげることでoriginの入力を省略してます。

pullした時の例

$ pull
remote: Counting objects: 6, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (6/6), done.
From github.com:aaaaa/iiiii
 * branch              develop    -> FETCH_HEAD
   ***********  develop    -> origin/develop
Updating ***********
Fast-forward
 path/to/filename | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

git pullしたときの挙動を今自分がいるブランチに直す方法がわからなかったので自分でつくりました。
誰かもっといい方法知っていたら教えてください〜

inductor
8割くらい正しい情報を噛み砕いて3秒で出すのが得意
https://inductor.me
infra-workshop
インフラ技術を勉強したい人たちのためのオンライン勉強会です
https://wp.infra-workshop.tech/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした