1,118 questions
Score of 1
2 answers
147 views
Check out a branch without populating worktree?
In a repo-construction script I'm writing, I have a need to check out a branch so that I get that branch's index file, but I have no need for the working files. In my situation, populating the ...
Score of 1
1 answer
435 views
VS Code Branch Switching (post worktree vscode update)
TL;DR:
The VS Code Git: Checkout to... command used to let me directly select a branch or tag. Now it first forces me to choose a repository, and only then the branch.
Is there a way to restore the ...
Score of 2
3 answers
282 views
Why is git HEAD pointing to two branches?
The git installed on my machine always creates master when I initialize any folder as git:
PS C: \job-artifacts-and-outputs› git branch --show-current
master
So my local branch name is always master ...
Score of 0
0 answers
110 views
Git checkout -p (patch) from one branch to another for a binary file?
Situation
I have a branch master/mywork and v4.9/mywork. These branches (and their parents, master and v4.9, to be precise) differ in many places but are also similar in many other places.
I created a ...
Score of -3
2 answers
174 views
should git checkout work when the index is dirty?
I created a branch to do some work on, tried to merge another branch into it, and immediately ran into an insurmountable merge conflict. Clearly the thing to do was abandon the branch and start over.
...
Score of 2
1 answer
90 views
Does updating the submodules before checking out a tag have any adverse effects?
I am trying to clone a git repo and checkout a particular tag. But I have a doubt regarding the order of commands. For now, I follow these steps:
git clone <some_repo>
cd <repo_dir>
git ...
Score of 0
1 answer
349 views
Your branch is ahead of 'origin/main' by X commits even after git push
I recently started using GitHub to manage my code, using git commit -a -m command to commit changes to all files (-a) added with git add <filename>, along with a message (-m).
After that, I run ...
Score of 0
1 answer
145 views
Can I checkout an unfetched remote git branch, with a single command?
A very popular question here on SO is:
How do I check out a remote Git branch?
but the answers there either assume the branch-of-interest is already fetched, or suggest that we git fetch first.
My ...
Score of 2
2 answers
337 views
Preserve ignored untracked files across checkout
I picked up an external project, which I will be developing from now on.
As a failsafe measure, I made 2 branches:
One without a .gitignore, so as to not lose untracked files, called gitignoreless.
...
Score of -2
1 answer
79 views
Is there a shorthand to go forward through children in git? (opposite of ~) [duplicate]
I have a completely linear git history (to make things simple), such that
git log --oneline --graph --all
shows
* eff3139 (branch_2) foo
* f217e05 bar
* 8d1c27b baz
* c10bb66 (HEAD -> master, ...
Score of -1
1 answer
63 views
Is there a command equivalent to `git checkout --theirs` and `git checkout --ours` with `git reset`?
I prefer to use other commands than git checkout because of the ambiguity of git checkout; I prefer to use git reset (and git switch for branches).
However, I have noticed that I don't know how to do ...
Score of 0
1 answer
875 views
gitlab runner skipping checkout even with GIT_CHECKOUT set to true
I have gitlab-runner 17.1.0. My .gitlab-ci.yml file has GIT_CHECKOUT: true, but gitlab still skips checkout. Any idea why?
This excerpt from log shows the problem:
Running with gitlab-runner 17.1.0 (...
Score of 0
1 answer
118 views
Git actions/checkout "ambiguous argument 'HEAD^'"
This is my first time using git actions. I want to create different filetypes of the same text using pandoc. Since I'm using free runtime for this (and there may be more actions to come) I want to ...
Score of 1
1 answer
434 views
GitKraken issue when checkout with submodule
I have a problem when I checkout from one branch to another in a repo containing git submodules.
For example:
parent-repo (branch master)
.
├── test.txt
└── README.md
parent-repo (branch develop)
.
├─...
Score of -1
1 answer
92 views
Quickly flip through Git commit history [duplicate]
I want to learn a new project, I need to constantly switch in the project's commit history so that I can view the code. First, I execute git switch --detach commit-hash to bring the project back to ...