git-rewrite-history

invalid author/committer line - missing space before email

纵然是瞬间 提交于 2019-12-02 00:39:14
问题 I have a git repository that was cloned from a bzr repository using git-remote-bzr as follows: git clone bzr::/repo new-repo . After a few hundreds of commits, I executed git fsck and I got the following error for all the bzr commits: error in commit 41bf5: invalid author/committer line - missing space before email When I check these revisions with git cat-file -p 41bf5 I can indeed see that the author name and the email are not separated with a space. How can I add this missing space for all

invalid author/committer line - missing space before email

旧城冷巷雨未停 提交于 2019-12-01 21:37:32
I have a git repository that was cloned from a bzr repository using git-remote-bzr as follows: git clone bzr::/repo new-repo . After a few hundreds of commits, I executed git fsck and I got the following error for all the bzr commits: error in commit 41bf5: invalid author/committer line - missing space before email When I check these revisions with git cat-file -p 41bf5 I can indeed see that the author name and the email are not separated with a space. How can I add this missing space for all the bad commits ? I have full access to the repo on the server so I can rewrite the history without

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

孤者浪人 提交于 2019-12-01 15:35:09
I was writing a simple script in the school computer, and committing the changes to Git (in a repo that was in my pendrive, cloned from my computer at home). After several commits I realized I was committing stuff as the root user. Is there any way to change the author of these commits to my name? Pat Notz Changing the author (or committer) would require re-writing all of the history. If you're okay with that and think it's worth it then you should check out git filter-branch . The man page includes several examples to get you started. Also note that you can use environment variables to change

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

China☆狼群 提交于 2019-12-01 13:40:48
问题 I was writing a simple script in the school computer, and committing the changes to Git (in a repo that was in my pendrive, cloned from my computer at home). After several commits I realized I was committing stuff as the root user. Is there any way to change the author of these commits to my name? 回答1: Changing the author (or committer) would require re-writing all of the history. If you're okay with that and think it's worth it then you should check out git filter-branch. The man page

BFG Repo Cleaner – Alternative to Fresh Clone

▼魔方 西西 提交于 2019-12-01 07:32:32
I was going to ask this on the repository but SO seemed like a more fitting place to ask this. I was able to use BFG Repo Cleaner (great tool, thank you!) to reduce our .git folder size by over 1GB, which is a smashing success as far as our repository is concerned. I have not pushed my bare clone to remote yet, as I am concerned with putting forward these changes before understanding the consequences of pushing and then not re-cloning. I understand that best practice dictates that when history has changed in this way, the best solution is to perform a fresh clone. However, I work with a team

Git repo still huge after large files removed from repository history

五迷三道 提交于 2019-12-01 05:56:38
I have a codebase that (until now) used git to store its dependencies. The repository itself is available here (warning: it's HUGE). Needless to say, I need to remove the dependencies from the repository history in order to cut it down to a reasonable size. I started by using David Underhill's instructions to remove the lib directory from the history. Even after doing this, however, the repository is still over 300M. Issuing git prune and git repack helps, but it's still over 180M. In an attempt to find any bloated blobs, I issued git verify-pack -v .git/objects/pack/pack-*.idx | grep -v chain

Git repo still huge after large files removed from repository history

橙三吉。 提交于 2019-12-01 04:50:12
问题 I have a codebase that (until now) used git to store its dependencies. The repository itself is available here (warning: it's HUGE). Needless to say, I need to remove the dependencies from the repository history in order to cut it down to a reasonable size. I started by using David Underhill's instructions to remove the lib directory from the history. Even after doing this, however, the repository is still over 300M. Issuing git prune and git repack helps, but it's still over 180M. In an

Git amend/reword (without adding/changing files)

烈酒焚心 提交于 2019-12-01 04:26:01
问题 Often I want to edit a commit message without having to re-select the file-set from the last commit. git commit file1.c file2.c Accidental typo in commit message. git commit file1.c file2.c --amend This works, but Id like not to have to re-select the file-set from the original commit, I once accidentally did git commit -a --amend and added many changes unintentionally. I know about git rebase -i HEAD~1 then replace pick with with r (re-word), but this ends up being a few steps. Is there a way

git-filter-branch to remove strings, but where strings contain $ ' \\ and other characters

假如想象 提交于 2019-12-01 01:21:58
I'm trying to rewrite history, using: git filter-branch --tree-filter 'git ls-files -z "*.php" |xargs -0 perl -p -i -e "s#(PASSWORD1|PASSWORD2|PASSWORD3)#xXxXxXxXxXx#g"' -- --all as described in this tutorial . However, the password strings I have contain all kinds of non- A-Z characters, e.g. $ ' and \, rather than being nice simple 'PASSWORD1' type strings in the example above. Can someone explain what escaping I need? I've not been able to find this anywhere, and I've been battling with this for hours. try the BFG instead of git filter-branch... You can use a much more friendly substitution

How to split every commit by file?

烈酒焚心 提交于 2019-11-30 17:04:23
问题 I know how to manually split a commit using git rebase -i , but how can I automatically split every commit in a branch by file? For instance, commit A modified 3 files, f1, f2 and f3. After the split, there are 3 commits A-f1, A-f2 and A-f3. I want to do this to make a major rewriting easier as I will only have to squash some small commits. 回答1: The Script The following script splits HEAD by file: #!/usr/bin/env bash set -e SHA=$(git rev-parse --short HEAD) git reset HEAD^ git diff-tree --no