LoginSignup
34
29

More than 5 years have passed since last update.

git pull --rebaseを使ってみた

Posted at

ローカルブランチで開発して、むやみにマージコミットを作りたくないので毎回rebase -> mergeとやってた
毎回やるの面倒だなーと思ってたそんなとき、git pull --rebaseを見つけたんだっていうメモ
pullした時の挙動が fetch -> mergeから fetch -> rebaseになるらしい

いつもだとこうやってた
(git stash save / popを使えばもう少し短くはなる・・・かな)

(my-topic)$ git commit -am "my commit"
(my-topic)$ git checkout master
(master)$ git pull
(master)$ git checkout my-topic
(my-topic)$ git rebase master
(my-topic)$ git checkout master
(master)$ git merge my-topic
(master)$ git push origin master

git pull --rebase使うとこんな感じ

(my-topic)$ git commit -am "my commit"
(my-topic)$ git checkout master
(master)$ git merge my-topic
(master)$ git pull --rebase
(master)$ git push origin master
34
29
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
34
29