'git add .' affecting line feeds of files outside .git folder - windows

I've got a series of HTML pages and other files for a website hosted on heroku sitting under a folder named 'sitename' on the User level of my computer - Windows 8 64 bit (that is, the files are in 'C:\Users\Me\sitename'
I'm trying to deploy them to the site using this code:
$ git add .
$ git commit -am "make it better"
$ git push heroku master
When I execute '$ git add .', the console starts returning tons of messages naming certain files and saying 'The file will have its original line endings in your working directory. warning: LF will be replaced by CLRF'.
Reading the question here, I found that it probably wouldn't affect anything in my code. However, when I run the code, it doesn't just affect the files in my git repository (which I think is set up correctly by running '$ git init', which creates a .git folder on the same level as the sitename folder), but starts to affect files in my AppData folder, e.g. iTunes.
Is this expected behavior? Will it affect anything? And is there a way to direct 'git add' towards only the repository?

I would recommend investigating where your git folder really is for your project first. Because it seems like you have somehow added files from the Appdata folder to your project, this indicates that the git folder you have created is not seperated from the other folders on the server. For example you have your git folder in:
'C:\Users\Me' instead of 'C:\Users\Me\sitename'
To easily see what files that have been added to your git project/Hasn't been added you can execute the command:
git status
This will also show your current staged files and if you have commited something.
To add single files/folder just write:
git add example.html
Where example is the name of the file you want to add (it can be any extension).
To remove files just do the same but use git rm.

Related

Is it possible to fix Windows altered case of file names with pull from remote git repo?

I have a problem where a Windows file restore changed the case of some file names. This causes a trainwreck with some projects.
Fortunately these projects are pushed to remote git servers. The remotes are up to date with origin/master, and cloning the projects is a solution. The only problem with that is the time-consuming task of replacing git-ignored files and dealing with other updates.
An ideal solution would be to pull down all files from the remote, overwriting the files in the origin/master. Is this possible? How do I force a pull down or merge, even though they are already a match. I want to keep it that way, just use git to rewrite the correct file name cases.
git pull or git pull -f results in Already up-to-date.
First, set git to be case sensitive. By default this was set true to match Windows:
git config core.ignorecase false
Check the list of changed-case file names Windows messed up. At the very least, this is your list of files to fix:
git status
Now, delete the files and folders that are messed up. Do not delete git ignored files! Files in .gitignore must be fixed the hard way.
Now, get your deleted files back as they were before Windows changed the case:
git checkout .
Yet another reason to quit Windows.

WHat does Cross sign indicates on a file in Git for windows

I am using Git client for windows.
I recently pulled a repository and did some modifications and deleted some files (Not shift delete).
When I undo-ed the delete I see the attached cross mark on the file/What does that mean?
If something is wrong , how can I revert back to the original situtaion.
Looks like you have deleted the file.
In order to revert (since i don't know which client you are using)
it open the git bash and follow this steps:
I assume you are using tortoise git:
# Open git bash in the desired folder
git status
# now you should see your desired file in the list marked as deleted
git checkout <file name>
Here is a screenshot for you

zsh/mercurial help on every command

Every command I make in terminal while in zsh I get the mercurial help appended.
Example:
$ ls
Applications Developer Library Pictures VirtualBox VMs
Consensus Documents Movies Projects
Desktop Downloads Music Public
haaduken at nachi in ~Mercurial Distributed SCM
basic commands:
add add the specified files on the next commit
annotate show changeset information by line for each file
clone make a copy of an existing repository
commit commit the specified files or all outstanding changes
diff diff repository (or selected files)
export dump the header and diffs for one or more changesets
forget forget the specified files on the next commit
init create a new repository in the given directory
log show revision history of entire repository or files
merge merge working directory with another revision
pull pull changes from the specified source
push push changes to the specified destination
remove remove the specified files on the next commit
serve start stand-alone webserver
status show changed files in the working directory
summary summarize working directory state
update update working directory (or switch revisions)
use "hg help" for the full list of commands or "hg -v" for details
$
I have absolutely no idea why. Any ideas how I can stop this? A lot of people are saying alias, but hg isn't in my alias list at all.
Did you add a Mercurial command to your PS1 variable? Some people do this, to display the current branch or bookmark.
What does 'echo $PS1' show?
It's possible you added an incorrect Mercurial command there, which results in printing the help message.

Git (windows 7) won't add directories, but adds files files typed explicitly

trying to find an answer to this, have seen it hinted at, but no solution.
Not entirely new to git, but haven't used it in a few months... this is my first time using it on windows. using git bash.
I have a cake PHP site that I want to add exluding any cache files my .gitignore file contains only:
app/tmp/*
Here is the most basic thing I have tried:
git init
git add .
git commit
I get a message on commit saying there are untracked files - all files and dirs at the root directory.
git status
gives me the same message.
However, if I type
git add .htaccess
it stages the .htaccess file.
Also, if I do:
git add app/.htaccess
It will add that file too.
I have also tried
git add app/*
no luck.
Thanks in advance.
The files aren't ignored, because otherwise you would be forced to do a git add --force afile.
However, you might want to check GIT_DIR and GIT_WORK_TREE environment variable, and see if they reference another repository, which could explain the discrepancy between the index and what you think is your working tree.

Tower (Git client) not cloning all directories to the local machine from the remote repository

I have an issue with a new remote repository that when cloned using Tower, doesn't clone all the directories.
When I created the remote repository, I did the following:
Created a .gitignore file containing the following line
files/cache/*
Then ran:
git init
git add .
git commit
I then cloned the remote repository to my local machine using a Mac OSX git client called Tower but noticed that many of the directories did not clone.
When I go back and look at my terminal session on the webserver, I can see the directories that weren't cloned listed after the initial commit - I see a whole bunch of lines that look like this:
create mode 10644 directory-name/path/to/file.php
create mode 10644 directory-name/path/file.php
create mode 10644 directory-name/path/to/file.php
create mode 10644 directory-name/path/file.php
So I'm guessing they were added but I'm also wondering if my .gitignore file is not setup right and is conflicting with Tower somehow?
I tried the .gitignore file a couple of ways, firstly like this:
files/cache/*
then like this:
files/cache/
After changing it to the second one, I ran git add -A (which didn't seem to add anything new) on the server and pulled the repo down using Tower again - but no luck.
Not sure if this is Git or Tower or both - not sure what I'm doing wrong, sorry.
Any help would be much appreciated.
Cheers
Ben
Don't forget that git won't add (and clone) empty directories.
(or directories with ignored content, making them empty for Git)
See:
"Does git ignore empty folders?"
"How do I add an empty directory to a git repository?"

Resources