I\'m just entering into the wonderful world of git.
I have to submit a bunch of changes that I\'ve made on my program, located in a directory called /var/www/myapp
You'll have to move all the files from /var/www/myapp to /home/mylogin/gitclone and then do a git add .
and then git commit -m "Your message"
.
When upgraded to git version 2.12.2 that error appeared, I nooted the i add the file with a full path like:
git add c:\develop\project\file.text
when removed the full path it start working, like:
git add file.text
That's because you are versioning stuff inside /home/mylogin/gitclone
and git tracks everything inside that folder. You cannot track other folders outside of this repository.
A solution might be create a submodule, or using a symbolic link using ln -s
Git only tracks files and folders within the root folder which includes the .git directory and the subfolders inside root folder. The folder you are trying to add is outside the scope of git.
What would you actually like to do is first git checkout -b myapp
which will create and checkout a new branch based on the master branch of the repository you cloned. Then you would actually copy all your files over and commit them with git commit -a -m "Short descriptive name about what you did"
. The parameter -a
you passed to git commit
is for including all the changes done to the repository and -m
is to include the commit message in the actual command. After that you can either push
back to the main repository if you have write access to it or push it to your own public repo or don't push it at all.
What I've described above is pretty much the basics of git. Try reading this book which is pretty descriptive.
To add some files or folder to your repository, they have to be in the folder you created with git clone
. So copy/paste your application in your local git folder and then go in it and do git add *
and then you'll be able to commit to the server with git commit -m 'message'
and finally push the changes to the server with git push
First in the clone folder you can create a Branch (so the master stay untouched)
git branch [branch_name]
After, just copy the files you want from your old folder to the clone folder.
When you are done, just add / commit your change and Merge your branch into the "master" branch. It will look like to something like this:
git add .
git commit -m "Comments"
git checkout master
git merge [new_branch]
Try this tutorial from GitHub.