git-bash

git checkout carries unstaged files to the new branch

独自空忆成欢 提交于 2019-12-02 11:22:33
问题 I have been trying to set-up repository with gitlab CE, as a part of the set-up created a repo and been playing around with it, when I encountered, that after I make some modification to files and switch branch using checkout, I'm allowed to switch even though I have unstaged files, which was different from my previous experience that I was not allowed to checkout until I either did a commit or stash. This experience beats the purpose of seamlessly switching branches without having to worry

Grep thinks text file is binary, but it isn't

Deadly 提交于 2019-12-02 07:22:40
I came across a .cpp file in our codebase that is seen as binary by grep. So I can't grep it like a text file, which is annoying and obviously not how things ought to be. So I want to know why grep thinks the file is binary and address the issue. I tried to find any characters out of the ordinary using the command grep -Pna --color -r "[\x00-\x08]|[\x10-\x19]|[\x80-\xFF]" test.cpp but it doesn't yield any matches. How can figure out the cause of this problem? I should mention I'm on windows git bash. Output of locale: LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en

git: why can I checkout to the commit I deleted?

不想你离开。 提交于 2019-12-02 07:00:47
问题 I have a branch with three commits: mybranch: a -> b -> c I pushed it to the remote repo. Then I decided that I don't want to keep the commits b and c , so deleted them as described here: git reset --hard HEAD~1 git reset --hard HEAD~1 git push origin mybranch -f Afterwards, I checked git log and confirmed that only the commit a was visible. However: I still can checkout to the commits b and c . Why is that? when I used SourceTree to look up my git repo, I still could see these commits in my

git checkout carries unstaged files to the new branch

流过昼夜 提交于 2019-12-02 04:36:27
I have been trying to set-up repository with gitlab CE, as a part of the set-up created a repo and been playing around with it, when I encountered, that after I make some modification to files and switch branch using checkout, I'm allowed to switch even though I have unstaged files, which was different from my previous experience that I was not allowed to checkout until I either did a commit or stash. This experience beats the purpose of seamlessly switching branches without having to worry about unintended creeping in. The steps are highlighted below. somasundaram.s@user /d/projects

Git add errors: Could not open directory: Permission Denied

风格不统一 提交于 2019-12-01 14:53:00
I am using windows 10. When I type the command "git add ." in my Git Bash I keeping getting this message as shown below: warning: could not open directory 'AppData/Local/Application Data/': Permission denied warning: could not open directory 'AppData/Local/ElevatedDiagnostics/': Permission denied warning: could not open directory 'AppData/Local/History/': Permission denied warning: could not open directory 'AppData/Local/Microsoft/Windows/INetCache/Content.IE5/': Permission denied warning: could not open directory 'AppData/Local/Microsoft/Windows/Temporary Internet Files/': Permission denied

Grep thinks text file is binary, but it isn't

寵の児 提交于 2019-12-01 11:56:24
问题 I came across a .cpp file in our codebase that is seen as binary by grep. So I can't grep it like a text file, which is annoying and obviously not how things ought to be. So I want to know why grep thinks the file is binary and address the issue. I tried to find any characters out of the ordinary using the command grep -Pna --color -r "[\x00-\x08]|[\x10-\x19]|[\x80-\xFF]" test.cpp but it doesn't yield any matches. How can figure out the cause of this problem? I should mention I'm on windows

How to set the correct local time zone in git bash?

杀马特。学长 韩版系。学妹 提交于 2019-12-01 06:51:08
I am using git-bash on a Windows system. The Windows clock shows local time, but inside git-bash everything is in GMT time: $ date Mon Mar 31 16:08:57 GMT 2014 Also setting TZ will not change things: $ TZ="Europe/Berlin" date Mon Mar 31 16:09:01 GMT 2014 Similarly all times it git log are GMT only. Is there a way to set the correct timezone in git-bash? On Windows the TZ variable seems to work differently . To get the German timezone you have to write: TZ=GST-1GDT date If you set it to some "invalid" value like "Europe/Berlin" it will default to GMT. The same seems to happen on my system when

git cleanup old branches

别说谁变了你拦得住时间么 提交于 2019-12-01 06:08:00
I'd like to create a git command that will delete any branches that have all commits included in the current branch e.g. $ git branch groups * master $ git cleanup-branches deleted groups # all commits are included in master $ git branch * master How would I go about creating this? You can leverage git branch -d here, as it won't delete any branch not yet merged into your current branch: git config --global alias.cleanup-branches \ '!git branch | grep -v "\*" | awk "{ print $1 }" | xargs git branch -d' Just tried this locally and it worked, although it is a little terrifying to watch it work.

How can I execute commands in git-bash in windows which are located in a folder with spaces ie “Program Files”?

岁酱吖の 提交于 2019-12-01 04:07:26
When I use git bash, from time to time I want to invoke a command wich is on my $PATH ( well actually on my %PATH% ) but if the command resides somewhere in a folder with spaces on it, it fails to run. For instance if the program is on C:\Program Files\whatever\aCmd.exe and I type aCmd on bash, it says "Program" is not a valid program and such. What I did was to re-install the program in a folder without spaces, but recently my coworkers are starting to leave git-gui and are using git-bash and the recurrent question is "How do I execute aCmd" and when I tell them to re-install it they go like

Git-Bash Command Prompt won't open up after upgrading to Windows 10

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 03:44:47
I just upgraded my OS to Windows 10 and Git Bash won't even open up anymore. I might need to uninstall and re-install it again but I was just wondering if anyone else ran into this problem after upgrading to Windows 10 and what their fix was other than un-installing and re-installing ? There have been few instances where other users who have upgraded to windows 10 are facing similar issues with respect to Git Bash and git in general. An issue has been opened with msysgit on GitHub. Official clarification will be posted on that page very soon. A similar issue but not related to Git Bash