Skip to main content
Filter by
Sorted by
Tagged with
1 vote
0 answers
42 views

How do I restore commit history for a specific file that has been renamed?

I am trying to move some files from one repository (source repository) to a new one (target repository), and I want to restore all the previous commits of those files into the target repository to ...
santacodes's user avatar
0 votes
0 answers
24 views

How to get `git fetch` to pull only the remote branch corresponding to the current local branch? Don't want it to pull in any other remote branches

Given $localBranch = git branch --show-current $remote = git config branch.$localBranch.remote $remoteBranch = git config branch.$localBranch.merge $remoteTrackingBranch = $remote/$remoteBranch when ...
joseville's user avatar
  • 937
-1 votes
0 answers
34 views

In bare git repo, local branch doesn't go to same commit as merge/upstream branch even though I do `git pull`, `git fetch`, `git merge`, `git rebase`

I have a local bare git repo foo.git. The remote (origin) repo has a branch named dev/jv/bar. In the local bare git repo, I did the following in PowerShell cd E:\repos\foo.git git worktree add dev/jv/...
joseville's user avatar
  • 937
0 votes
1 answer
62 views

Why does `git pull` pull 1000s of remote branches to my local?

When I do git pull it fetches all remote branches to my local. And it saves them as remote-tracking branches (this is not the issue, though). I think it also fetched tags and maybe other things too. I ...
joseville's user avatar
  • 937
2 votes
1 answer
51 views

`git fetch origin foo` vs `git fetch origin foo:origin/foo`

I have 2 remote branches, foo and bar. Neither foo nor bar exist locally. They appear in neither of the following git branch # local branches git branch -r # remote-tracking branches I did git fetch ...
joseville's user avatar
  • 937
0 votes
1 answer
55 views

Why does `git pull origin master:master` from non-master branch cause branch to be rebased?

I'm on branch master and do git log commit 9937b91089895fac45a39a3bda2935e19eb42554 (HEAD -> master, origin/master, origin/HEAD) ... git status prints On branch master Your branch is up to date ...
joseville's user avatar
  • 937
0 votes
1 answer
72 views

Why do I have to run "git branch --set-upstream-to=origin/<branch> local-branch-name" while doing git pull?

I am wondering why I have to git branch --set-upstream-to=origin/<branch> local-branch-name when doing git pull? Is there a way to keep the upstream the same as the current local branch of ...
caot's user avatar
  • 3,278
1 vote
0 answers
277 views

Git pull error: fatal: expected 'acknowledgments'

We are using Github to host our repo and the authentication mechanism is through an app. The git pull randomly fails with the following error. Emphasis on "randomly", it works 90% of the ...
Jay Joshi's user avatar
  • 1,522
0 votes
0 answers
120 views

When replying to sync, git fetch, or git clone, bad packet length xxxxx is reported

When I execute repo sync to pull a large project, I will report a Bad packet length xxxxx error, and sometimes I will also report this error when using git clone. How should I handle this? Error info: ...
user25382962's user avatar
0 votes
3 answers
135 views

How to get the name of a git repository after fetching it and checking it out? [duplicate]

If I were to clone a repository, git automatically determines the name of the repository and clones it into that directory. As per the git clone documentation: <directory> The name of a new ...
nfl's user avatar
  • 65
0 votes
1 answer
36 views

Fetch and set up remote tracking with a branch not listed in the git fetch config

I work in a very large monorepo, so by default the fetch configuration is constrained to avoid pulling down thousands of branches and slowing down git (i.e. fetch = +refs/heads/master:refs/remotes/...
mikemikemikemikemike's user avatar
0 votes
1 answer
59 views

ALTERNATE_DB_ENVIRONMENT environment variable does not work for setting alternate object directories in git

According to this comment in object-file.c in the source tree of git, setting the ALTERNATE_DB_ENVIRONMENT environment variable should work instead of using the .git/objects/info/alternates file. The ...
nfl's user avatar
  • 65
0 votes
0 answers
35 views

Redirect output to file in Jenkins is not the same then in cmd for git fetch

I would like to get some statistics on the data transferspeed of git fetch from our Windows Jenkins nodes. I thought of fetching a bare repo, and parsing the output of git fetch, witch keeps updating ...
Knuth Lohse's user avatar
0 votes
0 answers
29 views

Fetch remote changes with out changing branches in SourceTree

I have a local branch but someone pushed changes to another branch. I can see there are changes because the Source tree UI tells me. See red circles below. I know it's not hard to switch branches ...
Jon Vogel's user avatar
  • 5,546
0 votes
1 answer
1k views

fatal: ambiguous argument 'main': unknown revision or path not in the working tree

I'm using NX in my CI with GitHub Actions and I checkout the repository using actions/checkout@v4. When I try to use nx affected:..., for example nx affected:lint or nx affected:test it fails with the ...
Francesco Borzi's user avatar
0 votes
1 answer
35 views

How do I pull merged changes from a sub-branch back onto the original branch locally?

I created a branch. Let’s call it feat/feature1.0. My friend created a branch off of this branch. Let’s call it feat/feature1.1. My friend has committed and merged their changes into the original ...
Devvy's user avatar
  • 3
1 vote
0 answers
62 views

Why does fast-forwarding with git fetch reject an ahead branch?

To fast-forward from origin I can do git merge --ff-only origin/BR if BR is checked out, otherwise git fetch . origin/BR:BR (or git fetch origin BR:BR to also update origin/BR). Using git merge, if BR ...
H.v.M.'s user avatar
  • 1,599
1 vote
0 answers
56 views

How to git fetch and prune only a subset of exactly specified refs

I want to synchronize certain subset of custom refs from origin to the local copy: git fetch --force --prune origin refs/x/1:refs/x/1 refs/x/3:refs/x/3 I need git fetch to delete local ref when the ...
xmedeko's user avatar
  • 7,695
0 votes
0 answers
22 views

Working with two git repos on same server but without a bare-repo

I've been working for a while with git and multiple remote repos, cloned form a bare-repo. So, I could commit changes on one repo, push to the bare and fetch/merge into the other repo. On a new, small ...
phunsoft's user avatar
  • 2,715
1 vote
0 answers
68 views

Optimizing Git Cloning for Large Repository with On-Demand Access to Version History

I'm working with a large private Git repository with a single branch and I need to optimize the cloning process. My requirement is to later access the Git version history and the different versions of ...
Zeus's user avatar
  • 11
0 votes
0 answers
67 views

Error while pull/fetch changes from branch in WebStorm

Cannot fetch/pull changes from remote branch. I executed git command in WebStorm terminal: git pull origin dev Got this issue: fatal: bad object refs/heads/dev 2 error: github.com:MyProgect/settings....
Mykola's user avatar
  • 1
0 votes
1 answer
101 views

Git Log After Git Fetch Upstream

I really wanted to understand how git behaves and what's happening underneath the plans after I run a git fetch upstream HEAD on a clean local repository. Basically the steps were as follows: Create ...
rhuanpk's user avatar
  • 125
0 votes
1 answer
53 views

Difference Between HEAD and HEAD:HEAD

What is the difference between HEAD and HEAD:HEAD notation in git commands e.g.: git fetch origin HEAD:HEAD I can even understand what git fetch origin HEAD does, however, not using the other ...
rhuanpk's user avatar
  • 125
1 vote
0 answers
70 views

Restore a remote branch after a `git fetch --prune`

I ran git fetch --prune and I see: - [deleted] (none) -> origin/branch_name_here I can not tell from the branch name if it was an important reference. How do I find out where origin/...
Morrison's user avatar
1 vote
0 answers
48 views

What checks does git perform to "force update" in a fetch? Is it something I can actually *see*?

So let's assume I have the same repository in two different local directories, besides origin. Let's call these localA/master and localB/master. Both of them synchronized with an origin/master. The ...
M I P A's user avatar
  • 85
0 votes
1 answer
49 views

Fetch refs not associated with a branch

I have a program that runs some scientific tests. I have written a git post-receive hook for the server that runs these tests: When it receives a commit, e.g. deadbeef..., run the program Commit the ...
Zaz's user avatar
  • 48.2k
-1 votes
1 answer
84 views

How to solve conflicts while pulling a branch from a remote repository?

I am currently working on a project that involves forking a specific GitHub repository. In my forked version, I am required to incorporate a branch named windows into my project. The original main ...
Straw User's user avatar
0 votes
1 answer
540 views

Git cannot checkout remote branch despite `git ls-remote origin` showing it exists

I'm struggling to checkout a remote branch that I know exists, because it shows up with git ls-remote: $ git ls-remote 242d56fbd8d8af67df3157bd047252f5580e3df8 HEAD ...
Cornelius Roemer's user avatar
-1 votes
3 answers
2k views

Why does actions/checkout fetch the latest commit right after cloning the repository?

While trying to make sense of the action actions/checkout@version, I came across this answer in which the following was stated to explain what happens when the same action is executed: The default ...
Mehdi Charife's user avatar
1 vote
1 answer
66 views

How to merge large number of changes info common repo?

There are two developers working on branches dev1 and dev2, respectively, and usually every time one of them commits a change they do a PR into a common dev branch. Both developers have made a bunch ...
gkeenley's user avatar
  • 7,098
-3 votes
1 answer
517 views

How do I set git fetch --force in git config?

I want every fetch and pull to get tags from origin, replacing local ones if they differ, and delete tags and origin/ branches that are not on origin, so I did this: git config --global fetch.tags ...
H.v.M.'s user avatar
  • 1,599
0 votes
1 answer
434 views

git remove single line from file in git history

I accidentally committed a line of code that was not meant to be part of the commit. class Engine { x: X protected _events: Event // <-- this line was accidentally included y: Y the ...
Michael Moreno's user avatar
0 votes
0 answers
52 views

Git fetch on master breaks

I am trying to run below command after shallow clone. //Run first - Passes git fetch --depth 100 --update-head-ok origin master:remotes/origin/master // Run next - Fails git fetch --depth 100 --...
Hacker's user avatar
  • 7,866
5 votes
1 answer
90 views

Did git configuration `branch.<name>.fetch` ever exist?

Git configuration branch.<name>.fetch is mentioned in the first git-fetch example1: Update the remote-tracking branches: $ git fetch origin The above command copies all branches from the ...
muzimuzhi Z's user avatar
1 vote
1 answer
334 views

`git submodule update` always keep fetching the same commit

I have a Git repo with one submodule and two commits that change the submodule's HEAD. If I check out one of the commits, and do a git submodule update, this succeeds without having to connect to a ...
Cactus's user avatar
  • 27.5k
0 votes
1 answer
227 views

Network failure during git fetch command

I'm trying to investigate what happens if the network would fail during a git fetch command. I can't find any documentation that really goes into detail of the fetch command and digging into the git C ...
Johan Ahlqvist's user avatar
1 vote
3 answers
72 views

Why does this person (see link to article) use checkout to create a feature branch from the development branch and not fetch?

I thought you had to use fetch to get the latest version of a branch from the remote repository. If you do this as the person who wrote the article, don't you create a new feature branch from the &...
Jens's user avatar
  • 141
0 votes
2 answers
160 views

How do I make `origin/HEAD` work with partial fetch settings?

In a typical "regular" git clone, one ends up with .git/config as follows: [remote "origin"] url = [email protected]:orgname/reponame.git fetch = +refs/heads/*:refs/remotes/...
jakub.g's user avatar
  • 40.6k
1 vote
0 answers
177 views

How can I grab specific SHA-1 hashes from remote repositories?

This script iterates multiple Git repositories in order to get their latest commit SHA-1 per branch. These commands are launched inside an arbitrary .git directory, so Git commands can be invoked ...
Sovenique's user avatar
0 votes
0 answers
40 views

git fetch overwrote the current main with an old push to another remote, how to get my main back to how it is on github?

I wanted to get the tags that another contributor added to a github remote, so I ran git fetch --all --tags. The resulting fetch looked like this: $ git fetch --all --tags Fetching origin remote: ...
sigil's user avatar
  • 9,486
1 vote
1 answer
375 views

Can I set in Jenkins to not fetch every file from gitHUB?

I have a project on gitHUB where I have two '.txt' file at .project level. I would use them for comparison a previus run to a new run to find out the difference. I use Jenkins to build the project, ...
Péter Sánta's user avatar
0 votes
2 answers
1k views

Git pull shows "already up to date" but they're wrong

DISCLAIMER : There's already a post that already addresses this issue but sadly the author did not find any definite answer. Here's my issue : git pull shows "already-up-to-date" but they're ...
Zel's user avatar
  • 1
0 votes
0 answers
12 views

Is there a way to fetch individual subdirectories instead of entire git repo? [duplicate]

I'm working on a project where I would like to work on separate subdirectory without fetching the entire repo. As an example, project_repo has the structure: project_repo/ mainProgram/ pluginA/ ...
Nova67's user avatar
  • 1
1 vote
3 answers
671 views

Git push asks to fetch and merge but there is nothing to fethc or merge

I have been trying to get familiar with Git, new to programming. However, every time I seem to want to push git "git push origin main", I get an error saying my local and remote branches ...
Dan's user avatar
  • 35
0 votes
1 answer
192 views

Running <git worktree add> checks out older commit hash

Im running a jenkins pipeline, where: [Pipeline] { (Prepare) [Pipeline] sh + git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*' [Pipeline] sh + git fetch origin master From https://...
csaba's user avatar
  • 105
0 votes
1 answer
124 views

sharing a git repository to a machine that does not have internet access from one that has

I have this setup machineA -> remote server with a repo.git initialized with --bare machineB -> client that can access to internet and clone repo.git, so it locally will have repo machineC -&...
zerunio's user avatar
  • 13
2 votes
1 answer
567 views

How can I make `git fetch --all` fail/show me failures prominently, if any of the remotes fail?

My issue is that I have multiple remotes set up, but day to day I only push to one. Let's call this remote 'Frank'. The other one, I almost never pull from, lets call her 'Alex'. The 'Alex' remote is ...
AncientSwordRage's user avatar
0 votes
1 answer
1k views

Why does git require me to commit or stash local changes before doing a pull

I made a change to a file in my local working copy and the same file has been modified in the remote repo. When I do a git pull, git gives the message, "error: Your local changes to the following ...
racerX's user avatar
  • 1,020
0 votes
0 answers
1k views

Getting Permission denied when doing Git Pull

I am getting the following error when doing git pull: $ git pull remote: Azure Repos remote: Found 281 objects to send. (30 ms) Receiving objects: 100% (281/281), 49.09 KiB | 12.27 MiB/s, done. ...
Pedro Morales's user avatar
0 votes
1 answer
1k views

Unable to find remote git branch in remote -- BitBucket

Switched to a new machine. I need to pull the working branches which was pushed from my old machine to remote. But I am unable to find the remote branches via git command. I could see the branch in ...
user avatar

1
2 3 4 5
9