dahlbyk / posh-git Goto Github PK
View Code? Open in Web Editor NEWA PowerShell environment for Git
Home Page: http://dahlbyk.github.io/posh-git/
License: MIT License
A PowerShell environment for Git
Home Page: http://dahlbyk.github.io/posh-git/
License: MIT License
When I type git sub<TAB>
, the completion works as expected: the fragment is expanded to git submodule
. When I type git sub<TAB> up<TAB>
, the completion does not work.
I've also noticed that git ls-f<TAB>
is also not completed as expected (git ls-files
).
Hopefully faster than multiple git calls...
From the readme: "As in git status, index status is dark red and working directory status is dark green".
Isn't it the other way round? I've started to use posh-git for the first time, and have got confused by the index status colour vs the working directory status colour. Seems to me that index is green and w-d is red.
I installed posh-git to c:\Program Files\posh-git and when i restarted powershell this is what I got...
The term 'C:\Program' is not recognized as the name of a
spelling of the name, or if a path was included, verify t
At C:\Users\xxxx\Documents\WindowsPowerShell\
For some unexpected reasons module was not installed.
At C:\Users\Administrator\Documents\WindowsPowerShell\Modules\PsGet\PsGet.psm1:823 char:18
+ throw <<<< "For some unexpected reasons module was not installed."
+ CategoryInfo : OperationStopped: (For some unexpe... not installed.:String) [], RuntimeException
+ FullyQualifiedErrorId : For some unexpected reasons module was not installed.
Exception calling "GetDirectoryName" with "1" argument(s): "The path is not of a legal form."
At C:\Users\Administrator\Documents\WindowsPowerShell\Modules\PsGet\PsGet.psm1:171 char:67
+ $TempModuleFolderPath = [System.IO.Path]::GetDirectoryName <<<< ($ModulePath)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
You cannot call a method on a null-valued expression.
At C:\Users\Administrator\Documents\WindowsPowerShell\Modules\PsGet\PsGet.psm1:629 char:47
+ $destination.Copyhere($PSGET_ZIPFile.items <<<< ())
+ CategoryInfo : InvalidOperation: (items:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At C:\Users\Administrator\Documents\WindowsPowerShell\Modules\PsGet\PsGet.psm1:624 char:29
+ if ($PSGET_ZIPFile.items <<<< () | Where-Object { $_.Path -eq $ContentTypesXmlPath }) {
+ CategoryInfo : InvalidOperation: (items:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At C:\Users\Administrator\Documents\WindowsPowerShell\Modules\PsGet\PsGet.psm1:623 char:43
+ $ContentTypesXmlPath = Join-Path -Path <<<< $PSGET_ZIPFile.Self.Path -ChildPath '[Content_Types].xml'
+ CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
It takes several seconds for the branch and change stuff to show up.
Is this a core thing in posh-git.
I'd love to understand more about the implementation of how the information is gathered from the repo.
tried installing msysgit 1.7.7.1 and git stopped working. not sure if this is a posh-git thing or a git thing. but should probably be looked at.
As per your #TCCC12 demo, you wanted to do do git commit -C F<tab>
and have it complete to git commit -C FETCH_HEAD
. It didn't.
Posh shows the current branch in the commandprompt but it would be nice if it could also show the current branch revision/version/shorthash.
Maybe this is already possible but I'm not a powershell wizard yet.
There seems to be some sort of compatibility problem between posh git and PSCX. Loading both modules at once causes incorrect format for 'help' command output (all lines end with <- [m), tab completion for parameter names on many cmdlets no longer works, and tab completion becomes really slow.
(I'm posting this here, because GitHub said I should - I encountered this issue when launching the console from the GitHub for Windows app)
I (used to) use MsysGit, which looks in %HOME% for the .ssh folder. posh-git looks in %HOMEPATH%. This leads to two different .ssh folders.
Could posh-git be changed, so it looks for the .ssh-folder in %HOME% if this variable is present and falls back to %HOMEPATH% if it isn't? That way the transition from MsysGit to posh-git (or the use of both) would be a lot easier.
This is not really a posh-git issue, but more general to overriding the prompt function in powershell. Have you notice that running your custom prompt will clear $lastexitcode?
Create a script named "fail.ps1" that simple calls "exit 123". Run it and you'll see $? is false while $lastexitcode is 0. $lastexitcode should be 123. Run powershell without running your profile first, then run fail.ps1, and indeed $lastexitcode is 123.
I also posted this on SO, but thought you may be interested. Maybe you have some ideas?
http://stackoverflow.com/questions/6014042/custom-powershell-prompt-is-clearing-lastexitcode
Supporting git flow commands ( https://github.com/nvie/gitflow ) would be nice!
What do think about merging with my project https://github.com/dotCypress/ps-git-ignores ?
I can send pull request anytime.
Dark red color is barely visible on the dark blue background of the PowerShell window :(
C:\Projects\SiteSDK [master +0 ~1 -0]>
I'm getting some very strange behavior on my machine that I'm worried might be due to malware, but I want to eliminate post-git as a possible source first.
Do you guys have any idea where the string "flashplayerplugin" could be injected as to cause this error? It only happens in directories that are git repos. I'm running a full system check now, but wanted to get this in a public space just in case posh-git itself was the cause.
flashplayerpluginWindows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
Cannot index into a null array.
At C:\Users\jkodroff\Code\posh-git\CheckVersion.ps1:11 char:34
+ $version = [Version]$Matches[ <<<< 'ver']
+ CategoryInfo : InvalidOperation: (ver:String) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
WARNING: posh-git requires Git 1.7.2 or better. You have .
C:\Users\jkodroff\Code\rms [flashplayerplugincod-only flashplayerplugin +4 ~6 -1 !]>
C:\Users\aaronlev\chrome\chrome0\src [tab_states]> import-module PowerTab
PowerTab version 0.99.6.0 PowerShell TabExpansion Library
Host: ConsoleHost
PowerTab Enabled: True
C:\Users\aaronlev\chrome\chrome0\src [tab_states]> git branch ## Shows popup with list of files for autocomplete
C:\Users\aaronlev\chrome\chrome0\src [tab_states]> remove-module PowerTab
C:\Users\aaronlev\chrome\chrome0\src [tab_states]> git branch ## Cycles through branches
If there's a configuration option I'm missing, it wasn't clear to me -- search engines couldn't find me the answer either.
please.
I don't get tab completion on when typing "git rm "
I see [←[32mmaster←[m]>
What does the 32m and the ←[m indicate?
When using posh-git and trying to apply my stash, the following command
git stash apply --index 0
or git stash apply stash@{0}
Both give the error:
fatal: ambiguous argument '0': unknown revision or path not in the working tree. Use '--' to separate paths from revisions
Using the default Git bash works. What am I doing wrong?
If I cd into the location of a git repo via UNC (like //server/share/dir/subdir) then any git commands fail like so:
Microsoft.PowerShell.Core\FileSystem::\\groups\data\ctrhs\crn\ccrc\oncologynurse\programming\programs [(master)]> git status
'\\groups\data\ctrhs\crn\ccrc\oncologynurse\programming\programs'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
fatal: Not a git repository (or any of the parent directories): .git
Does that indicate bad config on my end? If so, how can I fix? If not--is it something you can fix? The msysgit bash command prompt doesn't have this problem.
Many thanks!
I'll often jump into a git repo and forget whether it's pushing to other git repositories or an svn repo. It throws me off for a few seconds when I see 'origin is not a repository'.
It would be nice if git-svn repositories had some type of distinguisher. Maybe [svn:master] or different color set.
I'm trying out posh-git, but it's still too slow. How do I uninstall it?
The introduction/README on the site should include a description of what the colors/text in the command prompt mean. A beginner's guide. This doesn't have to be long, but SOMETHING on the site explaining the project would be nice.
No date or time to be found in the history or diff screens. WHEN did this happen?
Currently we show "(unknown)" when the current directory is within a submodule. Should display part of the submodule SHA instead (like bash).
I installed GitHub for Windows, which include posh-git. When I use the included GitHub Powershell link, it loads posh-git.
Just loading the posh-git part in a new Powershell window is very slow, taking 8 seconds. Pressing the "enter" key on an empty line takes 3 seconds to show a new prompt.
Here's a video (needs Flash, no audio):
https://www.Scolab.com/Public/Jing/VideoPlayer/Jing.aspx?filename=../CM/slowposhgit2012-06-01_1507.mp4&width=1224&height=672
The machine is quite fast (Intel i7 laptop, dual-core with SSD hard disk). The project weight 726 MB and has 2500 folders and 16300 files, excluding the ".git" folder.
I can live with the slow loading, but not with the wait. Could it disable itself or limit itself if it detects that it's taking more than 500ms to show?
Thanks a lot,
Carl
Posh-Git includes a Start-SshAgent
cmdlet, but no corresponding Stop-SshAgent
command.
Why would I need one? Well occasionally it seems SSH Agent gets in a state where it's running, but it's not supplying my credentials. So I end up having to supply my pass phrase.
I end up wanting to restart the agent, but I have to go into task manager and kill the process and then run the Start-SshAgent
command.
I'd prefer to be able to run Stop-SshAgent
and then start it again. Or perhaps even have a Restart-SshAgent
command. :)
http://dahlbyk.github.com/posh-git/
This here project has long since outgrown a readme. Stuff that needs to be documented:
$GitPromptSettings
Colors/Delimiters$GitPromptSettings
Behaviors: Debug
, EnableFileStatus
, RepositoriesInWhichToDisableFileStatus
, etc$GitTabSettings
ssh-agent
HelpersUpdate-AllBranches
What else?
This is not an issue with post-git at all but the post-git user base might have some weight in getting a MS Connect item up-voted that will enable command line history across sessions with Powershell - Enable command history between sessions
Totally nuke this item if this isn't an appropriate venue to search for votes on this item
Looks like Chocolately has posh-git 0.4.0.20120717 from July 17, 2012
Link for reference http://chocolatey.org/packages/poshgit
WARNING: posh-git requires msysgit version 1.7. You have git version 1.7.9-rc0.
On Win8 Consumer Preview, posh-git embedded the git status information into the PowerShell prompt without a problem. On the latest build of Win8 Release Preview, I am no longer able to get the rich prompt. (Also looks like tab completion etc are broken.)
I also updated to the latest version of msysgit at the same time I updated to the latest Win8 drop, so I guess it could be a change there as well.
Add a parameter and functionality so the user has the option to enable "auto-update" functionality whereby upon opening Powershell, a git pull request will trigger causing the user's posh-git scripts to be updated to the latest version.
So we (GHfW) team have a PowerShell script that will list all remote branches that are already merged into a specified branch (it defaults to origin/master if no branch is supplied) and offer to delete them for you.
I'd love to clean it up and add it as a command to GitUtils.ps1
. Would you be interested in such a thing as part of Posh-Git?
Hi,
I've install GitHub for Windows(1.0.38.1) in 3 PCs and all set PowerShell as it's default Shell. But when I click "Git Shell" icon to open the shell console, my fast PC(core-i7) take the longest startup time(more than 12 secs), others slow PC just take about 2-3 secs. Could advise how to find the root cause of this issue?
Running the command git rm no longer tabs through files to be deleted
For instance
deleted /FolderA/fileA
deleted /FolderA/fileB
deleted /FolderB/fileA
git rm used to give
git rm /FolderA/fileA --first tab
git rm /FolderA/fileB --secondtab
now it gives
git rm ./FolderA -- first tab
git rm ./FolderB -- second tab
The code in question uses single quotes (') where double quotes are needed ("). When single quotes are used in PowerShell variables aren't expanded. http://windowsitpro.com/blog/single-quotes-vs-double-quotes-powershell-whats-difference
This means '.ssh$File' quite literally means '.ssh$File' and not '.ssh\id_rsa' (or what ever value is specified in $File) as was obviously expected.
Upgrading Git Fixes the issue but posh-git does not explain why it has funny behavior.
This is using the posh-git included in github for windows.
C:\dev\TeamHaven\cdsweb\Images [master]> git rm leftarrow.gif
rm 'cdsweb/Images/leftarrow.gif'
Deletion of directory 'cdsweb/Images' failed. Should I try again? (y/n) n
The file is marked for deletion though, but obviously if this isn't a spurious message, it's a bit concerning that it's trying to delete the folder too!
This maybe more of an issue w/ my git workflow so please help me if I'm doing this all wrong...
Setup:
My issue is when my state is Blue and I run "git pull origin master" I would expect my color to stay blue. However it turns red, it's not until I then run "git remote update" that it turns blue.
Is there a better workflow for me? Or any other thoughts on this?
Color should be explicitly disabled on "git status" call at GitUtils.ps1:104.
old: git status --short --branch
new: git -c color.status=false status --short --branch
Regards
Changing into SQLSERVER:\sql
yields an error:
The term 'w' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
I used PsGet (http://psget.net/) to install Posh-Git on my machine. It was lovely and easy! But now I noticed that my version of Posh-Git is out of date. :(
Ideally, PsGet would be updated frequently. But perhaps even better, have the PsGet package include the posh-git repository so that it's easy to update. :)
Here is my profile:
$agent = Get-SshAgent
if ($agent -eq 0) {
Write-Host "Starting SSH agent..."
Start-SshAgent -Quiet # Start agent
Add-SshKey # Add my default key
} else {
Write-Host "SSH agent is running (PID $agent)"
}
When this is run PS errors with
Get-SshAgent : The term 'Get-SshAgent' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Projects\Test\posh-git\profile.example.ps1:36 char:10
~~~~~~~~~~~~
I've modified the profile just to call Get-SshAgent on its own and the same error appears.
Should expand refs.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.