git-commit

How do I make a Git commit in the past?

ぐ巨炮叔叔 提交于 2019-11-26 18:00:01
I'm converting everything over to Git for my own personal use and I found some old versions of a file already in the repository. How do I commit it to the history in the correct order according the the file's "date modified" so I have an accurate history of the file? I was told something like this would work: git filter-branch --env-filter="GIT_AUTHOR_DATE=... --index-filter "git commit path/to/file --date " --tag-name-filter cat -- --all Chris Johnsen The advice you were given is flawed. Unconditionally setting GIT_AUTHOR_DATE in an --env-filter would rewrite the date of every commit. Also,

Why does 'git commit' not save my changes?

末鹿安然 提交于 2019-11-26 17:29:28
问题 I did a git commit -m "message" like this: > git commit -m "save arezzo files" # On branch master # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: arezzo.txt # modified: arezzo.jsp # no changes added to commit (use "git add" and/or "git commit -a") But afterwards, when I do git status it shows the same modified files: > git status # On branch master # Changes

Xcode 9 commit: Couldn't communicate with helper application

瘦欲@ 提交于 2019-11-26 16:32:03
问题 I've recently updated to OSX Sierra (from El Capitan) and to Xcode 9. I removed all compatibility issues (like autolayout issues) and would like to commit to my local gitrep now. the following error appears: I thought it might be the same bug appeared in XCode 7 mentioned here: Xcode and Git Source Control : “The working copy XXXXX failed to commit files” But it wasn't. I tried the solution mentioned above. Username and EMail are properly set. I did save everything, tried restarting the

How to reference the initial commit?

走远了吗. 提交于 2019-11-26 15:56:44
I've got a script that needs to reference the initial commit in a repository. git has the special reference HEAD , but doesn't have the corresponding TAIL . I cannot find anything in git help rev-parse that would seem to help me. Here's what I'd like to do: git show TAIL Here's one option I have: git show `git log --reverse | if read a commit ; then echo $commit ; fi` That's pretty hacky and depends on the output of git log not changing. Right now I just tag the initial commit and use that as my refspec. However, I'd like to release a general tool, so that's not a great option. Jakub Narębski

Using IntelliJ to amend git commit message

夙愿已清 提交于 2019-11-26 15:29:14
问题 Can one amend a git commit message using IntelliJ , or should one resort to command line? How can this be done please? 回答1: View => Tool Windows => Version Control. ( Windows (Alt + 9) / OS X (Cmd + 9) ) IntelliJ 2017.1 and higher => Go to Log and right click + reword or press F2. While you are on the same branch, ( your checked out branch is the same ) 回答2: Amend is supported: invoke "Commit Changes" and select the checkbox "Amend commit" in the Commit Dialog. Then press "Commit" button, and

Recover files that were added to the index but then removed by a git reset

北慕城南 提交于 2019-11-26 15:27:56
I added some files to the index but then by mistake I deleted them with git reset --hard . How do I recover them? Here's what happened: I added all files using git add . I then committed When I checked the status, there were still files that weren't included in the commit from the add, which was strange I added the untracked files again and it worked this time But I wanted everything to be in 1 single commit so I looked up how to unstage what I just committed I used git reset --hard HEAD^ — bad idea obviously, all files were deleted so then I used git reflog to find where I left off then I

Is it possible to set a git commit to have a timestamp prior to 1970?

ε祈祈猫儿з 提交于 2019-11-26 14:19:02
问题 Unix timestamps are signed 32 bit integers (64 bit on some systems today, or so I understand). On some software products this allows you to use dates going back as far as 1903 or so. However, when I try the following: git commit -m "this is a test commit" --date="1960-04-07 18:00:00" I receive an "fatal: invalid date format" error. This isn't very practical (I'm not a time-traveler), but I've been wondering about using git for historical purposes. Can this be forced with a git plumbing

git: Your branch is ahead by X commits

做~自己de王妃 提交于 2019-11-26 13:58:42
How does this actually come about? I am working in one repo by myself at the moment, so this is my workflow: Change files Commit Repeat 1-2 until satisfied Push to master Then when I do a git status it tells me that my branch is ahead by X commits (presumably the same number of commits that I have made). Is it because when you push the code it doesn't actually update your locally cached files (in the .git folders)? git pull seems to 'fix' this strange message, but I am still curious why it happens, maybe I am using git wrong? including what branch is printed in the message My local branch is

How does git commit --amend work, exactly?

只愿长相守 提交于 2019-11-26 13:51:55
I have seen GIT commit --amend in detached HEAD state . The question requires the answer to be more complex than needs be. I'd like to understand just how git commit --amend works in a normal HEAD situation. Assume that you're in a clean working state and that your repo looks as follows: If you then run git commit --amend write a commit message, save and quit your editor, the following happens: Your staging area—which, if you haven't staged any new changes, will be identical to commit f42c5 —is used to create a new commit: 31b8e . Its parent(s) will be the same as that(those) of the commit you

How to amend several commits in Git to change author

匆匆过客 提交于 2019-11-26 12:34:00
问题 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, so how can I correct these commits before I do so (only the 3 latest commits on the master branch)? I have been looking at git reset and git commit -C <id> --reset-author , but I don\'t think I\'m on the right track. 回答1: Rebase/amend seems inefficient, when you have the power of filter-branch at