Update git branch with master without merging

I am the only developer working on a rather large project. I made some important changes to master, and I'm going to resume work on a branch featurethat is behind a good deal. The branch featurereally needs changes from master, but I do not want to merge the changes into masteruntil the work on featureit is ready for release. I think this is a fairly simple matter to reboot, but I'm not sure. Below is a very modified version of my situation (the actual story is much longer).

* 0e109d5 - (HEAD, origin/master, origin/HEAD, master) latest commit
* 9188511 - major schema change
| * d3472a5 - (origin/feature, feature) feature branch commit
| * 6c36837 - Start of feature branch
|/  
*   80d93a8 - Base commit
  • I pressed featureon the remote control for safe storage, which is usually bad for a reboot. But since it was not shared with anyone else, can I just delete the remote branch and continue as it never existed? Mine remoteexists just for offline storage and security (it's a simple git server, not github).
  • Assuming that the remote branch is no longer a problem, can I just reinstall masteron featureand continue to work featurewithout quickly redirecting masterto the fixation of the last function?
  • I don’t think I need to choose cherry, because it featureneeds a lot of all the changes in master.
  • , ( HEAD feature.

. git, .

+4
3

feature , . feature master :

# while staying at feature branch
git rebase master

master, rebase.

( ):

git push -f origin feature

:

* newsha1 - (feature, origin/feature) feature branch commit
* newsha2 - Start of feature branch
* 0e109d5 - (HEAD, origin/master, origin/HEAD, master) latest commit
* 9188511 - major schema change
* 80d93a8 - Base commit

, , feature master.

+6

, rebase feature master. :

git rebase master feature

feature, :

git rebase master

:

  • , . rebase -f --force-with-lease. , .

    git push --force-with-lease origin feature
    
  • , . feature. --ff-only, , .

    git checkout master
    git merge --ff-only feature
    
  • , cherry pick.

  • . Patch .

    PS. git Patch. .

    git diff > some.patch
    git apply some.patch
    

    git diff > some.patch
    patch -p1 < some.patch
    

    git diff --no-prefix > some.patch
    patch -p0 < some.patch
    
+3

It seems to me that you just want to combine the masters into your functional branch?

git checkout feature-branch git merge master

will try to move all the commits to the master in your function branch so that you can deal with conflict / merge problems there without touching the current state master.

+1
source

All Articles