How can one change the timestamp of an old commit in Git?

The answers to https://stackoverflow.com/questions/179123/how-do-i-edit-an-incorrect-commit-message-in-git describe a way to amend previous commit messages that haven't yet been pushed upstream. ...

Undo change in git (not rewriting history)

I made a change in a script and committed it. Then I made a few other changes, and pushed them to a remote repository and such. Then I realised that first change I mentioned was stupid, and want...

How to change the author and committer name and e-mail of multiple commits in Git?

I was writing a simple script on the school computer, and committing the changes to Git (in a repo that was in my pen drive, cloned from my computer at home). After several commits, I realized I...

How to modify a specified commit?

I usually submit a list of commits for review. If I have the following commits: HEAD Commit3 Commit2 Commit1 ...I know that I can modify head commit with git commit --amend. But how can I modify...

How to squash all git commits into one?

How do you squash your entire repository down to the first commit? I can rebase to the first commit, but that would leave me with 2 commits. Is there a way to reference the commit before the first one?

How to remove/delete a large file from commit history in the Git repository?

I accidentally dropped a DVD-rip into a website project, then carelessly git commit -a -m ..., and, zap, the repo was bloated by 2.2 gigs. Next time I made some edits, deleted the video file, and...

Git error: Unable to append to .git/logs/refs/remotes/origin/master: Permission denied

I am having a strange issue that I can't seem to resolve. Here is what happend: I had some log files in a github repository that I didn't want there. I found this script that removes files...

How can I easily fixup a past commit?

I just read amending a single file in a past commit in git but unfortunately the accepted solution 'reorders' the commits, which is not what I want. So here's my question: Every now and then, I...

Git: pushing amended commits

I am currently working on a project and using machines in two different locations to do it. I have created a branch for the feature I am working on and when I finish some work on it I amend my...

How to substitute text from files in git history?

I've always used an interface based git client (smartGit) and thus don't have much experience with the git console. However, I now face the need to substitute a string in all .txt files from...

Rebasing a Git merge commit

Take the following case: I have some work in a topic branch and now I'm ready to merge back to master: * eb3b733 3 [master] [origin/master] | * b62cae6 2 [topic] |/ * 38abeae 1 I...

How to amend several commits in Git to change author

I have made a series of commits in Git and I realise now that I forgot to set my user name and user email properties correctly (new machine). I have not yet pushed these commits to my repository,...

Remove file from amended commit

I pushed a commit to a repo where I accidentally added a file. Nobody else has merged from the remote repo so I can rewrite history. But when I remove file(unstage, not remove from source control,...

Best practice for tracking upstream in fork on github

Summary: What are the best practices for handling long running tracking of upstream repositories where you want to maintain a set of local changes? I want to keep a fork on github up-to-date with...

Git Repository Too Large

I have a project with ~12MB worth of code and assets in it. I've been tracking it using Git, and just noticed that my .git folder is now just over 1.83GB. It consists of a few small files, and...

Tell git-blame to use imported history

I have a repository which was created by copying files (not the history) from an SVN repository, with many changes added on top since. I have since converted the history in SVN into git, and...

How to remove a too large file in a commit when my branch is ahead of master by 5 commits

I've been stuck all day on this issue, looking for an answer here :( ... Context I'm working alone on a project and I used github until now to save my work other than on my computer....

Git - Remove in between commit

Our team is doing several projects in PHP. We have wrongly committed a folder of One Project to another. Now, we want to remove that particular commit from the Project. If we remove the particular...

What are the best practices for having git clean history?

Reading about git workflows, I was wondering about the appropriateness of history rewriting. My workflow, and I imagine that of many others, is this: Take Github repository, let's call this...

How can I purge a word from git's history while maintaining as much history as possible?

TL;DR: There is a phrase in our git repository that must be removed from history, not just the heads of branches. What other ways are there besides removing it from the head of develop and making...

How to rewrite shared Git history already on Github?

I keep reading about the dangers of squashing/rebasing/amending commits that are already shared with your team members. If the team is asking for this change, how do we do it? Does everyone stop...

tf402455 when I delete feature branch

My company is using VSTS with git. The Access Control Summary settings seemed to have changed since yesterday in VSTS. I'm seeing a few more options than I was before. I'm a member of the...

How to suppress the editor for `git rebase --continue`?

I'm often rebasing interactive to make tiny changes in the history (for example removing a blank line, or editing one line). In most cases those changes are based on some peer review. At first I...

git rebase and sharing a feature branch?

Based on this: https://www.atlassian.com/git/tutorials/rewriting-history/git-rebase git rebase will make it possible to maintain a linear history (a merge "always" results in a fast-forward) But...

How to replace the history of a branch with another branch?

I have repositories that I migrated from Perforce into Git. Every while, I do a git p4 rebase (where p4 is alias for git-p4) on each repository in order to get new changes from Perfoce into Git....

How to restore linear git history after nonlinear merge?

Few commits ago I accidentally did a nonlinear merge in my master branch. I have a habit of always trying to keep a linear history, so now I would like to restore the linearity. I have made a...

Branching off of squashed branches

Suppose I have the following git history: a master branch starting with commit A, a feature-1 branch branched off of A with commits B and C, and a second feature branch feature-2 that built off of...

Make git `replace` commits permanent (or such)

I'm busy converting all my existing SVN repositories to Git, and at the same time also take the opportunity to use Git's ability to easily rewrite some history. For this I'm also using git...

How to modify remote history with git filter-repo?

In the past I've used git filter-branch to remove files from my git history. Following that, I can do a force push to update the remote repository. For example, removing all HTML files from the...

Resolve merge conflict in gerrit/git

At work we use gerrit for codereview and as a git server. Also we have the following workflow: For each feature create a new feature branch If feature is ready, push it to git push origin...