Update a local branch with the changes from a tracked remote branch

后端 未结 2 1805
长发绾君心
长发绾君心 2021-01-29 21:05

I have a local branch named \'my_local_branch\', which tracks a remote branch origin/my_remote_branch.

Now, the remote branch has been updated,

2条回答
  •  面向向阳花
    2021-01-29 21:25

    You don't use the : syntax - pull always modifies the currently checked-out branch. Thus:

    git pull origin my_remote_branch
    

    while you have my_local_branch checked out will do what you want.

    Since you already have the tracking branch set, you don't even need to specify - you could just do...

    git pull
    

    while you have my_local_branch checked out, and it will update from the tracked branch.

提交回复
热议问题