Open joaquin-gimenez opened 5 years ago
how do fetch and pull work? do they get latest commit independent of a new release version/tag? cause i can't see why this is happening. I know fetch should get latest to remotes/origin/master but it's not happening
repo, err := git.PlainOpen(repoDir) err = repo.Fetch(&git.FetchOptions{ RemoteName: git.DefaultRemoteName, Tags: git.AllTags, Force: true, RefSpecs: []gitconfig.RefSpec{"+refs/heads/:refs/remotes/origin/"}, Depth: 2, }) workdir, := repo.Worktree()
refName := "refs/remotes/" + git.DefaultRemoteName + "/master"
head, _ := repo.Head()
if head.Hash() == ref.Hash() { //they are same }
how do fetch and pull work? do they get latest commit independent of a new release version/tag? cause i can't see why this is happening. I know fetch should get latest to remotes/origin/master but it's not happening
repo, err := git.PlainOpen(repoDir) err = repo.Fetch(&git.FetchOptions{ RemoteName: git.DefaultRemoteName, Tags: git.AllTags, Force: true, RefSpecs: []gitconfig.RefSpec{"+refs/heads/:refs/remotes/origin/"}, Depth: 2, }) workdir, := repo.Worktree()
refName := "refs/remotes/" + git.DefaultRemoteName + "/master"
head, _ := repo.Head()
if head.Hash() == ref.Hash() { //they are same }