Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git add regex example

Tags:

git

I am trying to add part of a commit using

git add -p

I chose the regex option

/ - search for a hunk matching the given regex

The patch contains these lines

+      AMFObject obj2;
+      AMFObjectProperty p;
+      AVal redirect;

But git doesn't seem to find it

search for regex? redirect
No hunk matches the given pattern
like image 759
Zombo Avatar asked Nov 10 '12 15:11

Zombo


People also ask

What is git add *?

The git add command adds new or changed files in your working directory to the Git staging area. git add is an important command - without it, no git commit would ever do anything. Sometimes, git add can have a reputation for being an unnecessary step in development.

How do you git add all modified files?

The easiest way to add all files to your Git repository is to use the “git add” command followed by the “-A” option for “all”. In this case, the new (or untracked), deleted and modified files will be added to your Git staging area.

How do you git add all?

To add and commit files to a Git repository Create your new files or edit existing files in your local project directory. Enter git add --all at the command line prompt in your local project directory to add the files or changes to the repository. Enter git status to see the changes to be committed.

How do I add all Java files to git?

Git facilitates us with a unique option of the add command by which we can add all the available files at once. To add all the files from the repository, run the add command with -A option. We can use '. ' Instead of -A option.


1 Answers

The issue was that this patch affected more than one file.

I needed to chose

d - do not stage this hunk nor any of the later hunks in the file

until reaching correct file, then regex will work.

like image 77
Zombo Avatar answered Oct 13 '22 15:10

Zombo