git-commit

Unexpected behavior with “git commit .” when pre-commit hook modifies staged files

房东的猫 提交于 2020-04-15 03:45:31
问题 In my experience git commit -a has had equivalent behavior to git commit . However, recently I have created a pre-commit hook that automatically formats my source code and now git commit . has some unexpected side-effects: the file that is committed ends up as modified in the working directory and in the index after the commit command finishes. This doesn't happen with git commit -a . I'm trying to understand what is going on behind the scenes when running git commit . that is causing this to

How Can I Update My Github Pages Website?

允我心安 提交于 2020-03-28 06:57:05
问题 I have my github website deployed to a.github.io. Now, I have made some changes locally and want to push changes but I am unable to do so. This is what the settings of my repo says in the Github Pages section: In my repo, I can see that the commits are being shown. However, the website is still not updated. If I run it locally, i see the changes but not on the actual website. Note that the original account where website it hosted is also different than the one through which I am making

How to cancel a local git commit

倖福魔咒の 提交于 2020-02-16 13:19:11
问题 My issue is I have changed a file eg: README, added a new line ' this for my testing line ' and saved the file, then I issued the following commands git status # On branch master # Changed but not updated: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: README # no changes added to commit (use "git add" and/or "git commit -a") git add README git commit -a -m 'To add new line to readme' I

How to cancel a local git commit

a 夏天 提交于 2020-02-16 13:19:11
问题 My issue is I have changed a file eg: README, added a new line ' this for my testing line ' and saved the file, then I issued the following commands git status # On branch master # Changed but not updated: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: README # no changes added to commit (use "git add" and/or "git commit -a") git add README git commit -a -m 'To add new line to readme' I

How to remove a commit from the middle of a branch

一世执手 提交于 2020-02-01 05:28:04
问题 I've made some commits and have pushed it to my remote repo. One of those I want to remove. It includes only one binary file, which was changed only in that commit in that branch. How to remove it without harm for later commits? 回答1: You can use interactive (-i) rebase to remove a previous commit. $ git log # copy the target commit $ git rebase -i <target-commit>~1 # start rebase from the previous commit of target commit An editor will open with a list of commits, one per line. Each of these

Why git operations becomes slow when repo gets bigger

六眼飞鱼酱① 提交于 2020-01-24 11:53:29
问题 I know git would get slow when the repo get bigger. But why? As git stores files as separate directories and files under .git , i can not find out why the operations get slowwer. Let's have a look at the commit operation. Recently, i cloned the webkit repo and i branch from master, then i commit a 2k file to the branch. But i feel it gets slowwer than that i do on my small repo. Because i have not read through git source code, i guess the commit operation compromises storing the file to the

Smartgit error: “Push Error Not all refs have been pushed”

笑着哭i 提交于 2020-01-16 03:41:05
问题 I am using Smartgit with a repository hosted from 'bitbucket.org'. I got this error message: Error Not all refs have been pushed And changes are not committed. What does this error mean? Here is the complete log for my latest action around this repo: LF will be replaced by CRLF in apps/frontend/modules/persona/templates/indexSuccess.php. The file will have its original line endings in your working directory. LF will be replaced by CRLF in apps/frontend/modules/persona/templates/indexSuccess

Aborting commit due to empty commit message (editor = atom)

夙愿已清 提交于 2020-01-13 04:55:28
问题 Does anyone actually use atom for git commit messages here? I want to but I'm having this problem and have been sticking with git commit -m '....' . When I try to use atom, it opens atom and almost immediately i get this message from git bash: hint: Waiting for your editor to close the file... Aborting commit due to empty commit message. 回答1: I understand you have switched to SublimeText since your question, but for others: Recent (April 2019) atom/atom issue 19147 set [core] editor = atom -

Change git email for previous commits

喜你入骨 提交于 2020-01-10 10:18:12
问题 So I read a lot about how to change previous commit's email address but for some reason mine is not updating. I did like 40 commits to my private repo with my local email (nameofMyComputer@kevin.local) which is bad since this email is not associated(and it can't be) with github. I then remembered that I needed to set the git.config before and so I did: git config user.email "newemail@example.com" and did a test commit and it worked perfectly. Is there a way I can revert all my previous

Standard to follow when writing git commit messages [duplicate]

老子叫甜甜 提交于 2020-01-10 06:20:26
问题 This question already has answers here : Git Commit Messages : 50/72 Formatting (5 answers) Closed 5 years ago . I find myself managing very many files (over 60 but below 70) and my commit messages so far follow this pattern: when I have added something like on layout.css , my commit message is "added something on layout.css file" , and when I remove something, my commit message is "removed something from layout.css file" . Some files down the line, I look at my commits feed and added... and