github - What's the difference between `git reset --hard master` and `git reset --hard origin/master`? -
i tried lot of links on stackoverflow/elsewhere understand behaviour of
git reset --hard option
i know that:
- if omitted or if
origin, reset done on recent commit onorigin - if sha1 hash provided, reset done on corresponding commit.
what don't understand following values:
originheadorigin/masterorigin/branch
all seem have same behavior i.e. point latest commit on master.
please explain significance of 4 value option provided above.
i know if on specific branch how can reset last commit on branch? if example on v1.2, origin/v1.2 still takes me latest commit on master.
first of need understand branch , tag names pointers hash values, represent single commit, if there's 4 options have same behaviour, first logical answer because point same commit
origini'm not sure thinkoriginself resolveorigin/headthink dependent on github settings, in github set 'default branch',origin/headresolveorigin/[default_branch], in case im assuming it's master, why has same effectorigin/master.headpoints current commit, 1 standing on,git reset --hard headpermenantly remove changes in tracked files , staged files changes, not change commit hash.origin/masterlast commit in remote master branch since last fetch/pull, each time commitmaster, localmasterupdated ,origin/masterupdated too, if else pushesmasterrepo have no idea there update, unlessgit fetchorigin/mastermove ahead ofmaster, or maybe diverge.
runninggit reset --hard origin/masterhave same effect if onmasterbranch ,masterin syncorigin/masterorigin/branchi'm not sure represents, because there's noorigin/branchdefault, i'm guessing created branch calledbranch, happens in same commit master, confirm can try doinggit branchsee branches, i'm guessing you'll find 1 calledbranch
to see in visual way, try running git log --graph --decorate --all or prefer visual tool gitk, if have binary installed run gitk --all see branches relative each other
Comments
Post a Comment