git-add

git bash shell on Windows “Your edited hunk does not apply”

最后都变了- 提交于 2019-12-06 16:56:05
I have a very frustrating error when trying to manually edit hunks while using the command: git add -p I have already looked through many of the existing questions on this site, including this one , and this one . I am at the point where I try to manually edit a hunk, make no changes to the file opened by git for manual editing, and still getting the error "Your edited hunk does not apply". I thought this might have to do with CRLF vs. LF EOL characters. I am editing in Notepad++, and I can see that all of my line endings are CRLF. I naively tried to change all the line endings to LF, but to

How to add symlinks to git repository on Windows?

眉间皱痕 提交于 2019-12-05 04:55:27
I compile binaries for OS X using GitHub' s electron environment and want to add the output to a git repository. I tried git add . error: readlink("sulu.app/Contents/Frameworks/Electron Framework.framework/Electron Framework"): Function not implemented error: unable to index file sulu.app/Contents/Frameworks/Electron Framework.framework/Electron Framework fatal: adding files failed Any idea to work around this? Windows command mklink /H "Link_File_Path" "Target_File_Path" Use above command to create a hard link for all your output files. That will work. I did similar stuff for git hooks. Refer

Unable to Git-add with force

瘦欲@ 提交于 2019-12-04 23:52:02
I get git-status at ~/bin: # Untracked files: # (use "git add <file>..." to include in what will be committed) # # screen/dev/ I run git add --force screen/dev/ I get the same git-status as before. I add each file in the folder independently, but I get the same git-status. There is no .git in screen/dev/. The folder seems not to be a sumbodule. How can you add a folder and its content with force to my git at ~/bin? You should not need ' --force ' or ' -f ' option: see git add : -f --force : Allow adding otherwise ignored files. In your case, you may not want to add all files, included ignored

What is the meaning of the “bang” or “!” before the git command?

孤者浪人 提交于 2019-12-04 23:39:20
As you can see from this excerpt, there is a "!" before the git command. What's the point? [alias] commitx = !git add . && git commit - https://stackoverflow.com/a/8956546/1354543 I understand aliases and what the command itself is doing, but not the point of the "!" before the git command. The ! means "run the following as commands to the shell", so in this case the alias git commitx expands to the equivalent of running git add . && git commit (which is a terrible terrible idea) An important aspect of ! not covered by the accepted answer is that for the shell command, the working directory is

Unstage all deleted files in Git

跟風遠走 提交于 2019-12-04 11:54:09
问题 I want to unstage all file deletes. Is there an easy way? I want to apply this to the file pattern of all deletes. 回答1: The output of git status --porcelain is a great way to build one-liners and scripts for tasks like this: git status --porcelain | awk '$1 == "D" {print $2}' | xargs git reset HEAD 回答2: In case your path-/filenames returned from git status contain space characters, the call to awk can be modified to include the entire (quoted) path/filename including spaces: git status -

`git add --patch` with `--word-diff`

爱⌒轻易说出口 提交于 2019-12-04 02:46:55
git add --patch provides a great interface for reviewing unstaged changes and then staging only the ones that are wanted in the next commit. Great, except for one thing: there is no obvious way to choose which diff view to use. In particular, I would like to be able to configure git add --patch to present diffs to me the same way that git diff --word-diff does. How can I achieve that? (N.B. neither --word-diff nor --word-diff --color is exactly the same as --color-words , and so this question (and its answer ) are different to this question and its answers. However, that question's answers are

Why is split option missing in git add -p?

匆匆过客 提交于 2019-12-03 18:00:10
问题 Trying to split a hunk into smaller ones by git add -p and split option, but entire file appears as one hunk and I can't split it. I can edit, but removing lines causes the patch to fail. git help add says I should have split, and I recall using it, but in my current example the option doesn't appear in the prompt. When I choose the option help is printed, which says I can choose s to split :-[ Git version: 1.9.1. Xubuntu 14, oh-my-zsh. The hunk is not one line, it's multiple lines. Any ideas

How do I place a dummy file in a git repo?

强颜欢笑 提交于 2019-12-03 13:30:49
I'm new at git so please bear with me. Say i have a file under version control that includes sensitive data. Sure enough, I put that file in my .gitignore file, so it doesn't get pushed to the repo. The problem now is somewhere in my project i have a line like #include <sensitivedata> or whatever your language of choice is. The problem is whenever somebody clones from that repo, that file is missing and he gets a fatal error when trying to build / compile the solution. So, instead of pushing the file I'm actually working on I want to push some dummy file with the same name instead, where I

Untangle two lines with `git add -p`

℡╲_俬逩灬. 提交于 2019-12-03 11:53:21
问题 I've got a file with the following changes: # Manual hunk edit mode -- see bottom for a quick guide @@ -280,6 +281,7 @@ if( foo ) { bla(); - test( true ); + removeThis(); + test( false ); } else How can I commit the change for test() only, and avoid committing removeThis() ? Each time I try to edit the hunk manually git tells me it does not apply cleanly. 回答1: How can I commit the change for test() only, and avoid committing removeThis() ? That's simple. Enter add -i mode, then select 5: [p

why `git diff` reports no file change after `git add`

巧了我就是萌 提交于 2019-12-03 08:43:18
问题 Why is that git diff thinks there are no changes ..even if git status reports them as modified ? $ git status On branch master Your branch is ahead of 'origin/master' by 2 commits. (use "git push" to publish your local commits) Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: file-added modified: file-with-changes << it knows there are changes but in order to see the difference, I need to explicitly add the last reversion hash.. $ git diff (nothing) $ git diff