'How to git add some file to repository?
Solution 1:[1]
When you git add x, git will use x as a startingpoint for finding your file. Imagine it as a regex. It therefore takes wildcards such as *
in order to e.g. add an entire subdirectory at once. (git add directory/*
)
Your error is pretty clear though. menu.php is simply not found. But your git status clearly tells you which path you'll have to specify.
Solution 2:[2]
Here is how I stage files for a commit to avoid typing errors! It also speeds things up quite a bit.
- Type
git status
to pull up a list of modified files that you would like to add in the bash window. - Type
git add
press space bar then double click or click and drag on the file that you would like to add so it is highlighted. - Next, press ctrl + insert this will copy your selection to the clip board.
- Next, press shift + insert this will paste your selection from the clip board to the bash command line.
- Lastly, Press Enter this will now add the file to be staged if everything was typed correctly.
Best Regards!
Solution 3:[3]
Note that a simple git add .
would add all your files.
If it adds too many (like the table.blade.php
), you can reset it (un-stage it)
git reset resources/views/users
Solution 4:[4]
Best way to add all files in one go in git , you can use this command after
git init
then use git add --a
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | FMaz |
Solution 2 | |
Solution 3 | VonC |
Solution 4 | Tanya sharma |