commit

git find fat commit

天涯浪子 提交于 2019-12-17 08:56:31
问题 Is it possible to get info about how much space is wasted by changes in every commit — so I can find commits which added big files or a lot of files. This is all to try to reduce git repo size (rebasing and maybe filtering commits) 回答1: You could do this: git ls-tree -r -t -l --full-name HEAD | sort -n -k 4 This will show the largest files at the bottom (fourth column is the file (blob) size. If you need to look at different branches you'll want to change HEAD to those branch names. Or, put

git commit frequency

对着背影说爱祢 提交于 2019-12-17 07:10:11
问题 Since i switched to git from svn i started make more commits every time i recompile and my tests pass i commit my work. In the end i end up committing function by function. I also track some other projects using git like emacs,wordpress etc. I see that they do not commit that often. So i am wondering how ofthen do you commit? 回答1: The guideline for the Git project itself (and the Linux project, AFAIK) is one commit per "logically separate changeset". This is a little ambiguous, but you

git - Find commit where file was added

假如想象 提交于 2019-12-17 04:12:29
问题 Say I have a file foo.js that was committed some time ago. I would like to simply find the commit where this file was first added. After reading the answers and my own tinkering, this works for me git log --follow --diff-filter=A --find-renames=40% foo.js 回答1: Here's simpler, "pure Git" way to do it, with no pipeline needed: git log --diff-filter=A -- foo.js Check the documentation. You can do the same thing for Deleted, Modified, etc. https://git-scm.com/docs/git-log#Documentation/git-log

How can I push a specific commit to a remote, and not previous commits?

天涯浪子 提交于 2019-12-17 01:21:51
问题 I have made several commits on different files, but so far I would like to push to my remote repository only a specific commit. Is that possible? 回答1: To push up through a given commit, you can write: git push <remotename> <commit SHA>:<remotebranchname> provided <remotebranchname> already exists on the remote. (If it doesn't, you can use git push <remotename> <commit SHA>:refs/heads/<remotebranchname> to autocreate it.) If you want to push a commit without pushing previous commits, you

How can I push a specific commit to a remote, and not previous commits?

冷暖自知 提交于 2019-12-17 01:21:30
问题 I have made several commits on different files, but so far I would like to push to my remote repository only a specific commit. Is that possible? 回答1: To push up through a given commit, you can write: git push <remotename> <commit SHA>:<remotebranchname> provided <remotebranchname> already exists on the remote. (If it doesn't, you can use git push <remotename> <commit SHA>:refs/heads/<remotebranchname> to autocreate it.) If you want to push a commit without pushing previous commits, you

How to revert multiple git commits?

一曲冷凌霜 提交于 2019-12-16 20:05:09
问题 I have a git repository that looks like this: A -> B -> C -> D -> HEAD I want the head of the branch to point to A, i.e. I want B, C, D, and HEAD to disappear and I want head to be synonymous with A. It sounds like I can either try to rebase (doesn't apply, since I've pushed changes in between), or revert. But how do I revert multiple commits? Do I revert one at a time? Is the order important? 回答1: Expanding what I wrote in a comment The general rule is that you should not rewrite (change)

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

老子叫甜甜 提交于 2019-12-16 19:57:23
问题 The answers to How to modify existing, unpushed commits? describe a way to amend previous commit messages that haven't yet been pushed upstream. The new messages inherit the timestamps of the original commits. This seems logical, but is there a way to also re-set the times? 回答1: Use git filter-branch with an env filter that sets GIT_AUTHOR_DATE and GIT_COMMITTER_DATE for the specific hash of the commit you're looking to fix. This will invalidate that and all future hashes. Example: If you

Make SQLAlchemy COMMIT instead of ROLLBACK after a SELECT query

非 Y 不嫁゛ 提交于 2019-12-14 04:18:24
问题 I am developing an app together with a partner. I do the database part ( PostgreSQL ), my partner implements the app on the web-server with python using SQLAlchemy . We make heavy use of stored procedures. A SELECT query on one of those looks like this in the db log: SET TRANSACTION ISOLATION LEVEL READ COMMITTED; SELECT col_a, col_b FROM f_stored_proc(E'myvalue'); ROLLBACK; In the stored procedures I write certain input to a log table. The app queries by SELECT , SQLAlchemy only sees a

vimrc auto-commit w/message prompt

懵懂的女人 提交于 2019-12-14 02:34:04
问题 I use the following command in my vimrc to auto commit on save. I find this very useful. However I do not like that I am stuck with the same commit message every time. autocmd BufWritePost * execute ':silent ! if git rev-parse --git-dir > /dev/null 2>&1 ; then git add % ; git commit -m "Auto-commit: saved %"; fi > /dev/null 2>&1' What I would like is to receive a prompt when saving that allows me to either provide a commit message or press enter and use the "Auto-commit: saved %" as a default

Subversion and mixed-revisions: recipe for broken builds?

为君一笑 提交于 2019-12-13 15:05:49
问题 I'm just comming back to subversion after using TFS for some time and generaly i'm quite exited :) There is one thing i remember differently. I don't remember beeing able to commit from an out of date working copy. Or maybe my memory just fails me on the definition of "out of date". I thought "out of date" meant that any file had been touched since i last updated my working copy, and not just that a file I touched locally had been touched (what i would call a conflict). The reason why I see