Git : Pull changes from remote branch without committing locally and finally push local changes to same branch

huangapple go评论54阅读模式
英文:

Git : Pull changes from remote branch without committing locally and finally push local changes to same branch

问题

我的团队正在主要的Git仓库的一个分支上工作。我是新加入的团队成员。我已经克隆了仓库并在同一个分支上进行了一些本地更改。现在其他团队成员已经在该分支上进行了多次提交。每当有这样的提交时,我想在本地不进行提交的情况下拉取它们,然后将我的更改推送到远程分支。

我看过一些答案,比如使用git stash和git rebase,但我感到困惑(我对这些命令的理解不够)。我正在寻找一组适当的命令来完成这个任务。

英文:

My team is working on a branch of the main git repo. I'm new to the team. I've cloned the repo and made some changes on the same branch locally. Now other team members have made several commits to the branch. Whenever such commits are made I want to pull them without making a commit locally and then push my changes to the remote branch.

I read several answers like using git stash and git rebase but I'm confused (I lack the understanding of these commands properly). I'm looking for a proper set of commands for this.

答案1

得分: 2

你可以在从远程仓库拉取代码后,使用 git stash 来储藏你的工作,然后可以轻松地应用储藏并将你本地的更改与远程的更改合并。

英文:

You can stash your work by git stash after pull from remote you can easily apply stash and back your local changes with remote changes.

huangapple
  • 本文由 发表于 2023年7月13日 15:23:06
  • 转载请务必保留本文链接:https://go.coder-hub.com/76676875.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定