2,181 questions
Best practices
1
vote
3
replies
71
views
Resign commits without losing dates
I don't have access to the GPG key right now. How can I make commits and then sign them on another computer? I know about git rebase, but it's important to me that the dates in the GitHub repository ...
Advice
1
vote
13
replies
144
views
How does Git decide which files need to be diffed in the `diff-files` step of `git commit`?
This is a question about the algorithm that Git uses and would ideally be answered by someone who has experience with the Git source code or who can find Git documentation that answers the question.
...
1
vote
1
answer
126
views
Why is my git `commit-msg` hook not receiving commit message arg and failing? [closed]
I have a git hook commit-msg that checks the format of the commit message and rejects it if it is incorrect.
The hook was working fine until recently (and was not modified recently). But now whenever ...
0
votes
0
answers
88
views
confused PyCharm project and submodule displaying structure when committing
background
My original project structure is like this:
20240720 # project root
├── tests
├── vnpy # submodule
├── vnpy_clickhouse # submodule
├── vnpy_datafeed # submodule
└...
-1
votes
2
answers
65
views
Fix history gap of deleted and then recreated file
I recently did a migration of a project (Flutter, if it matters) from an old version of the framework it is using to a newer one. At one point in the migration branch, I deleted most of the source ...
1
vote
1
answer
67
views
Eclipse eGit: Cannot move source files into Staged Changes
This is a Java project using Eclipse and GitHub archiving -- has been running for several years.
Something weird happened with Eclipse (MacOS). I went to Search the workspace for a text string "...
0
votes
4
answers
321
views
What is the difference between a stash and a regular commit?
From Git - git-stash Documentation:
A stash entry is represented as a commit whose tree records the state of the working directory, and its first parent is the commit at HEAD when the entry was ...
-2
votes
1
answer
96
views
Visual Studio Code Source control not displaying files modified
I am trying to setup a React project in my laptop , cloning from a repository. Using VS code . Any files changed or added is not displaying on the source control. However only when made some changes ...
1
vote
0
answers
120
views
`git log` shows commits not upstream any branch or tag
I often watch git log --all --oneline --graph --decorate --colors to keep an eye on my rebases. Today, something rather unsettling is showing up:
* b782b84 (HEAD -> dev, origin/dev) III
* 22fe431 ...
0
votes
0
answers
33
views
Unstaged changes disappearing after saving files in Visual Studio 2017
I am using Visual Studio 2017 (version 15.9.70 recently updated), and I am facing an issue where unstaged changes are disappearing after editing and saving any file. I can see the changes briefly in ...
0
votes
1
answer
176
views
Configure gitlint to ignore long links when they exceed the maximum line length
gitlint is a handy tool and for example useful to limit the max line length of commit messages to 72 characters - as widely adopted standard across many projects. However, this rule also doesn't allow ...
0
votes
2
answers
318
views
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository
After I used all the commands
git add .
git commit -m "tracker project"
git remote add origin https://github.com/pqd.git
git branch -b
git branch -a
git branch -m main
git branch main ...
0
votes
1
answer
62
views
Bring Changes from a commit HEAD into a branch
I have a feature branch ff which is based on main.
I want to bring changes made by a commit HEAD abcde on top of ff.
How can I do this?
1
vote
0
answers
46
views
Put the bumped part in the message of bumpversion
In order to let Bumpversion make a commit message like this:
<date>|<bumped part>|<current version>|<message>
(Where the <bumped part> means major, minor, or patch)
I ...
3
votes
4
answers
132
views
Is there a way to `git commit --patch --only`?
Say I’ve been staging changes using git add, but then realize that there is some small change—consisting of a single hunk, let’s say—I should commit separately before committing the staged changes. ...
0
votes
3
answers
206
views
Prevent developer from code commit if there is error in project build in Visual Studio
Few of my team members sometimes commit code without building project/solution which gives error to other team members when they get latest and build project.
Example:-
Error in code
Still commit ...
3
votes
1
answer
77
views
Does the commit ID of a submodule in the parent repository automatically update after a new commit is made in the submodule?
I have a Git repository with a submodule, and after creating a new commit in the submodule repository, I noticed that the commit ID of the submodule in the parent repository automatically updated when ...
23
votes
4
answers
19k
views
Git not committing, gpg stuck in database_open waiting for lock
When I attempt to commit in Git through R, I continuously get revoked access.
The error is:
gpg: Note: database_open 134217901 waiting for lock (held by 9857) ..
I have pushed.
I have pulled.
I have ...
0
votes
1
answer
58
views
Enrich git log with a custom dynamic content
Is there a way in Git to have a nice commit graph like this gives,
git log --graph --oneline --all --decorate
But with additional information, which would be retrieved from a custom executable?
...
1
vote
1
answer
508
views
How to create and download a patch from specific commit in Azure Devops Repos portal
I have an Azure Repo setup for my project. I am able to see the history of all commits from specific branch. I would like to download one of the commits as a patch. I found the option to cherry pick ...
0
votes
1
answer
147
views
GitHub ghost users as commits when using Source Control in Visual Studio 2022
I'm using Visual Studio 2022 Community.
I have only used Source Control in Visual Studio once. I decided to use it again, following this tutorial.
I created a simple solution that has nothing but ...
-1
votes
1
answer
71
views
Issues with commit message when pre-commit hook changes files
I have prepared the following pre-commit hook:
#!/bin/sh
# Run flake8 and mypy
flake8 ./src
FLAKE8_EXIT_CODE=$?
mypy ./src
MYPY_EXIT_CODE=$?
# If either flake8 or mypy return an error, skip black ...
0
votes
1
answer
136
views
gitkraken conflicts prevent checkout
I am using GitKraken and am currently trying to change from the feature branch to the develop branch, but an error saying conflicts prevent checkout. What should I do? It has currently been merged ...
0
votes
2
answers
1k
views
How do I change the git author/committer name/email for multiple commits while keeping the commit timestamp as they are?
I have used a wrong email for a project and need to change it all over the commits, and the solution from a post I found works great, but it resets the timestamp to the current time.
I ran this ...
0
votes
2
answers
2k
views
How can I roll back an outgoing commit that has not been pushed up to devops?
I've created a branch and made some changes and attempted to commit and push. The commit was created, but the push failed because I hadn't selected the branch I should have been developing on and was ...
0
votes
1
answer
440
views
Why is there no "update:" conventional commit? Should we always use "feat:" when updating? [closed]
I am learning the conventional commits. I am curious if we update some feature or a little of code patch, why don't we use "update:" in the conventional commits?
I have read that there is ...
0
votes
0
answers
29
views
Automated git message formatting [duplicate]
I am looking for automated way to create commit message of specified format in Git. So that, when I type git commit, I would see Vim editor with already preformatted commit message, like this:
[...
0
votes
1
answer
406
views
Is there a way to force git to commit an unchanged file?
I know that this is not normal practice and that my question is a "long shot". But is there a way force git to commit an unchanged file, so as to run githooks when the commit is pushed to ...
-1
votes
1
answer
68
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 ...
0
votes
0
answers
75
views
Reverting master to a few commits back
I want to revert a few commits I pushed from master to master.
Total novice here. I have a Github repository where I have edited a bunch of codes in the past few weeks. I edited codes on the Github ...
2
votes
2
answers
898
views
Remove all commits prior to a commit with `git filter-repo`
Is there a way to 'remove' all commits prior to a specific commit all the way to the root commit?
I figured git filter-repo does this kind of stuff?
Although I wasn't sure if it will work when root ...
0
votes
0
answers
162
views
Maintaining stacked PRs with constant amending
My employer requires that all pull requests contain a single commit. So I often have several inflight PRs that depend on each other. Given master -> branch A -> branch B, when I need to update A,...
2
votes
1
answer
57
views
Remove Committed files from local git repository
I am working on a local git repository project that is not linked or hosted on any remote repository. I actually have to submit this repo as a project but I accidentally committed a .class file on it. ...
-1
votes
1
answer
125
views
Is there a way to reset or remove all my commits into the dev branch?
I have been working on different branches and anytime task is ready I commit and create a pull request into the dev branch. Till now everything is okej, but is there a way to reverse or remove all ...
0
votes
0
answers
28
views
intellij # lines show in commit log
I'm trying to commit in IntelliJ. I'm using WSL2 Ubuntu and have set a commit template with:
git config commit.template $HOME/.gitmessage.txt.
When I commit in zsh, it works fine, but when I use the ...
-1
votes
1
answer
119
views
git: commit amend created parallel commits
Using PHPStorm's interface, I committed five files and pushed to GitHub (I'm the only developer - I just use GitHub as a sort of backup). Then I realized a little more clean-up was needed on one of ...
0
votes
0
answers
50
views
Author Name missing/wrong in Commit besides correct config
Whenever I create a commit in git, the author name is set to y for some reason e.g.
commit a9d8e57d15asdfb06865858fa6dsdsfd4ae42850d5d83
"Author: Y "
Date: Mon Jun 3 14:13:27 2024 +0500
...
0
votes
2
answers
111
views
Why can I not undo some changes in Git?
This is very silly. The code base I am working on doesn't have a gitignore, so I have to manually undo some changes before I push.
In the photo, I can undo certain changes. However, when it comes to ...
0
votes
1
answer
51
views
git is trying to merge on 'edit' command during 'git rebase --interactive <commit>'
I have history in git like the following:
<hash2> commit2
<hash1> commit1
<hash0> initial commit
I do git rebase -i <hash0> and choose to edit (pick -> e) both commits (...
-1
votes
1
answer
183
views
Git commit the file currently being edited in VS Code [duplicate]
Is there an easy way in VS Code to commit only the file you are currently editing? I mean GUI equivalent for git commit pathspec where pathspec is the file currently being edited (and saved).
man git-...
3
votes
1
answer
62
views
How do I use `git commit -v` with `git rebase -i`
When doing a git rebase -i and, say, squashing two commits together, Git will bring up an editor with the commit messages in it for me to edit.
Normally when I do a stand-alone git commit, I use the -...
0
votes
1
answer
45
views
What is the Git command to sync an already deployed github project with the visual studio code?
I have my project in visual studio code and I have published in github as well. But due to some faulty , my node modules got published as well in github. After performing rm -rf node modules ...
0
votes
0
answers
1k
views
Commit button has disappeared from source control in vscode, how can I get it back?
Recently I went to update my site in vscode. After making a few changes I saved the file, but realized all the changes were stuck in pending.
After messing around some, the pending changes showed up ...
1
vote
0
answers
36
views
How to "rebase" within a branch to an older commit?
I am using commits to push/pull untested and unfinished code to a private, personal work-in-progress remote repo. That is, these commits serve only to synchronize across devices that I'm working on ...
0
votes
1
answer
763
views
How can I delete one commit completely from GitHub?
I have some orphaned commits accidentally committed to GitHub.
Following this QA answer, I use git reflog expire --expire-unreachable=now --all to remove them from git rev-list --all. (I tried use git ...
-1
votes
1
answer
85
views
why git isn't committing the insertions?
I am trying to commit a file called "index.html" using git but git is committing just a empty file without any insertions even after I make sure the file have changes, this is the terminal ...
5
votes
2
answers
2k
views
copy author and date from other commit, but _not_ the message
In this QA we learn how to use git commit -c or git commit -C to copy the commit metadata from a different commit. This includes author, date and message.
What I would like to do is copy the author ...
-1
votes
1
answer
722
views
git commit not working github (GIT: Failed to execute git )
I tried it in CMD/Gitbash/Vscode/Rubymine
In vs code I get:
IN ALL TERMINAL'S I GET:
THIS IS THE GitLog ()even though I try to create the file manually it doesn't work any way:
10:27:56.174: [app-...
1
vote
1
answer
253
views
Problem with subtrees and signed commits in GitHub
We are working with GitHub as repository and all the commits must to be signed.
All team members have configured Git to sign the commits with their own SSH key.
Everything is working fine, but the ...
-1
votes
2
answers
98
views
git reset head --hard deleted local files
I'm not sure where to start. I'm a beginner at git and trying to get the lay of the land.
Today I was working on a project and did not commit. My last commit was yesterday. I got on my PC and decided ...