153,748 questions
-1
votes
1
answer
24
views
How to systematically untrack build files from a git repository?
Branch x in my git repository contains the undesired build files. It happened because I do not separate build directory from the source code and I git add-ed the build files. The main branch is in a ...
2
votes
1
answer
36
views
How do I re-use existing submodule checkouts when creating a worktree in Git?
I have a project where I have checked out the main branch, which has 2 submodules: vendor/foo and vendor/bar. If I create a worktree for a feature branch with git worktree add ../feature feature, this ...
1
vote
2
answers
50
views
git is showing unmerged paths: both modified
I have a visual studio project which uses git. I don't normally use VS for my work - this is a side project - I normally work from the command line and I'm a git novice anyway. I must've done ...
0
votes
0
answers
29
views
How to add an existing Angular project into the same Git repo as my ASP.NET Core Web API (VS + VS Code setup)?
I am building a full-stack project where:
Backend: ASP.NET Core Web API (created in Visual Studio 2022)
Frontend: Angular project (created separately in VS Code)
Git: I initialized Git from Visual ...
0
votes
1
answer
38
views
Is the hash for a Git submodule associated with the section key or with the path?
I'm doing something with git-filter-repo that is like the convert-svnexternals script here:
https://github.com/newren/git-filter-repo/blob/main/contrib/filter-repo-demos/convert-svnexternals
In that ...
Advice
0
votes
8
replies
109
views
Why does Git not support nested branching, and how can I design a versioning system that does?
I’m building a file versioning system for my product ThinkNCollab, which includes both a Task Management System and an advanced File Versioning System.
While designing the CLI for the versioning ...
-3
votes
2
answers
92
views
How to mark commit for upcoming release branch merge?
There is following Git branch setup with long living release branches:
develop branch
current release branch based on develop somewhen in the past. Release is very soon.
a minor release shall be ...
Best practices
0
votes
4
replies
87
views
How can I keep my main branch clean while still getting daily GitHub contribution activity?
The problem is that committing to the main branch every day makes the history messy, but commits made in other branches do not appear in the GitHub contribution graph (the green boxes).
What can I do ...
-5
votes
0
answers
48
views
Git clone fails with error: [Git repo is not cloning ] — how do I fix this? [closed]
I'm trying to clone a GitHub repository, but I get fatal: repository not found. The repository exists, the URL is correct, and I have access. What could be the possible reasons for this error please ...
Advice
1
vote
2
replies
73
views
How to make `git branch --show-current` work on GitLab?
There are several questions on stack overflow asking how to get the current branch name on GitLab. The interwebz are full of countless variations of that same question. The answer that is always ...
1
vote
1
answer
97
views
GitHub and squash merge being overridden when PR is approved
I was having a look at the history of my main branch in Git today, and I noticed that, despite the fact that I've configured branch protection of the main branch, and only allowed merging squash ...
0
votes
0
answers
49
views
DevSecOps pipeline — scans run on test branch, but devs keep pushing to dev/preprod/prod, how to ensure new code is scanned before production?
I’m an intern working in DevSecOps. Our repo uses branches: test, dev, preprod, prod. I’ve set up scans (SAST, container scan , DAST ) triggered from the test branch.
But the dev team often pushes ...
2
votes
1
answer
61
views
How to compare the changes in two branches?
Say I have four commits A, B, C and D, with A being an ancestor of B and C being an ancestor of D. I now want to verify that the changes from A to B are the same as the changes from C to D (or show ...
2
votes
1
answer
72
views
How does git read-tree behave in a single-tree merge, since it doesn’t seem to fully follow the documentation?
I created the following test repository (you can copy the commands):
$ git init repo && cd repo
$ touch file
$ git add . && git commit -m "Initial commit"
[main (root-commit) ...
2
votes
1
answer
52
views
Stop tracking files that match the patterns in a newly added .gitignore file
When you inherit a code base where gitignore has not been used then the first thing you want to do is add a standard gitignore file like this one Standard Visual Studio gitignore file for example. But ...
0
votes
1
answer
50
views
Does fs.watch in Node.js listen to changes in hidden folders like .git?
If I watch a directory that has a .git inside of it and run fs.watch, does that listen to changes within .git folder?
For example if I use:
fs.watch(dir, { recursive: true }
-3
votes
0
answers
39
views
Remove Git log history [duplicate]
Issue:
Some code containing a Client ID and Client Secret was accidentally pushed to the integration branch. Although those changes have now been reverted, the issue is that multiple branches had ...
Advice
1
vote
3
replies
75
views
Is there a way to use a custom diff algorithm in Git?
One really common issue I encounter is that Git is purely text-based, and doesn't know anything about the language of the file it's tracking. Most of my time spent resolving merge conflicts is fixing ...
0
votes
1
answer
65
views
How can I completely ignore git submodules (but keep them updated)?
I work in a large shared repo that has submodules that I never touch, but that I can't just git-ignore because sometimes they get changes that affect things I do touch. For instance, if I branch off ...
Best practices
3
votes
6
replies
173
views
Find the commit that deleted a particular line
With git blame --reverse revision..HEAD -- file I can get the contents of file at commit revision, with each line annotated with the last commit this line is still present.
I'd like to find the commit ...
Best practices
0
votes
4
replies
149
views
Worktree usage in git
I recently came accross the worktree concept in Git. I find it quite interesting since, in my company, we have a very large .git repo. The thing is that most of the employees tend to have a lot of ...
3
votes
1
answer
75
views
When would adding --first-parent to git rev-list --all HEAD <path> cause additional commits to be output?
I have encountered a situation where adding the --first-parent option to git rev-list --all HEAD <path> causes additional commits to be output. Specifically, the following command:
git rev-list ...
3
votes
1
answer
74
views
cygpath not found in PATH launching Git GUI from Windows run dialog
I use Autohotkey to launch Git Gui and gitk and tile them side by side:
:*:gth::
{
GitToolsHere(A_Clipboard)
}
GitToolsHere(path)
{
GitGuiHere(path)
GitkHere(path)
}
; Open GitGUI at ...
1
vote
1
answer
185
views
Unable to rebase due to nonexistent local changes
I made a program named proofread and it does two jobs: one is to remove trailing spaces and another is to add a newline.
I set it as a clean filter as follows:
# .gitattributes
*.c filter=c13an3r
*.h ...
3
votes
3
answers
180
views
git config alias function : Bad substitution
I have the following git alias function that moves files into a directory using git mv of those files and then does the git commit :
[alias]
mv-into-dir = "!mvIntoDIR() { \
cd ${GIT_PREFIX:-.}; \
...