So when using Git in MSVS you can use Fetch to see what incoming commits are waiting on you. Is there a way to set this to happen automatically, or am I forced to click on Fetch every time I think about it?
More generically, if you're not on the master branch, use git log .. @{u} to see the commits that are on the upstream remote tracking branch of your current local branch. @sschuberth This should be the answer.
To do that in Visual Studio, first make sure to fetch and get the latest updates from your remote repository Git > Fetch. Then right click on the remote branch you would like to review and select Checkout Tip Commit.
Still in Solution Explorer, right click on the file and choose "View History". In the history window, find the commit for the version you want to test with. Right click on it and choose "Open". This pops up a temporary file with the contents of the desired version.
I got a different but approaching need (I used git-tf on a big project, git tf fetch
was taking too long, so I did it in the background to speed up git tf pull
command). I poll every 10 minutes, and show the differences visually in the command line. Maybe this can help you:
I use a powershell script to poll:
function backgroundfetch
{
while ($true)
{
# Get latest
git fetch;
# Clear console
cls;
# Leave space for progress bar
for ($i=0; $i -le 6; $i++) {Write-Host;}
# Show commit differences between master and origin/master
git lgori;
# Show progress bar before next fetch
for ($i=0; $i -le 1000; $i++)
{
Write-Progress -Activity "Sleeping" -status ("{0:0.00} minutes remaining" -f ((1000-$i)/100)) -percentComplete ($i/10);
Start-Sleep -s 0.6;
}
}
}
And 2 git aliases
git lg
: a pretty git log
alias with graphgit lgori
: to show visually the commit differences between master and origin/master, using the first aliasin .gitconfig:
[alias]
lg = log --graph --format=format:'%C(yellow)%h%C(reset) %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(bold white)- %an%C(reset)%C(bold blue)%d%C(reset)' --abbrev-commit --date=relative
lgori = !git lg HEAD origin/master --not `git merge-base HEAD origin/master`^
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With