git - Does reset could work against remote branch? -


i saw command

 git reset --hard origin/master 

is working via remote tracking branch.

is possible reset against remote branch , not remote tracking branch?

warning: these commands have power change history.

use them if understand , accept risk.

the command git reset --hard origin/master wouldn't have effect on remote branch if applicable; effectively, you're telling local branch move head same commit reflected in origin/master repository knows it. not touch remote branch.

if git fetch wasn't run prior, do run risk of overwriting local repository older variant of remote repository, entirely fixable git fetch && git reset --hard origin/master.

if wanted reset commits against remote repository, have first apply them local repository, force-push them via git push -f.

note these kinds of changes respect git done local repository first; if want publish them remote repository, have invoke different commands.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

Laravel mail error `Swift_TransportException in StreamBuffer.php line 269: Connection could not be established with host smtp.gmail.com [ #0]` -

c# SetCompatibleTextRenderingDefault must be called before the first -