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

c# SetCompatibleTextRenderingDefault must be called before the first -

C#.NET Oracle.ManagedDataAccess ConfigSchema.xsd -

c++ - Fill runtime data at compile time with templates -