How to “pull” from a local branch into another one?

后端 未结 4 1480
無奈伤痛
無奈伤痛 2021-01-29 17:33

This sounds so simple, but I just can\'t figure it out. I made an experimental branch a while ago, and now I\'d like to pull in all the changes that happened on master since I m

相关标签:
4条回答
  • 2021-01-29 18:14

    Quite old post, but it might help somebody new into git.

    I will go with

    git rebase master
    
    • much cleaner log history and no merge commits (if done properly)
    • need to deal with conflicts, but it's not that difficult.
    0 讨论(0)
  • you have to tell git where to pull from, in this case from the current directory/repository:

    git pull . master
    

    but when working locally, you usually just call merge (pull internally calls merge):

    git merge master
    
    0 讨论(0)
  • 2021-01-29 18:34

    What you are looking for is merging.

    git merge master
    

    With pull you fetch changes from a remote repository and merge them into the current branch.

    0 讨论(0)
  • 2021-01-29 18:36

    If you are looking for a brand new pull from another branch like from local to master you can follow this.

    git commit -m "Initial Commit"
    git add .
    git pull --rebase git_url
    git push origin master
    
    0 讨论(0)
提交回复
热议问题