Git local changes

git status
Changes files in your working directory
git diff
Changes to tracked files
git diff <filename|filepath>
Show or list our the changes of specific file as per comparison to previous commit
git add . | git add ..
Add all current changes to the next commit
git add FILENAME
Add particular file changes to the next commit
git add -p
git commit
git commit -m 'Commit description'
git commit -a
git commit --amend
git commit --amend -m "an updated commit message"
git commit --amend --no-edit

Git create a repository

git init
Create a new local repository
The git init command creates a new Git repository. It can be used to convert an existing, unversioned project to a Git repository or initialize a new, empty repository. Most other Git commands are not available outside of an initialized repository, so this is usually the first command you’ll run in a new project.
git clone <url>
Clone an existing repository
s a Git command line utility which is used to target an existing repository and create a clone, or copy of the target repository. In this page we’ll discuss extended configuration options and common use cases of git clone.
It can be used to:
– clone a local or remote repository
– clone a bare repository
– use shallow options to partially clone repositories
– git URL syntax and supported protocols

Git config file tips

These commands work on /.git/config file
git config --system--unset credential.helper
git config --global--unset credential.helper
git config --global credential.helper wincred
git config --global credential.helper osxkeychain

To update your credentials, go to Control Panel → Credential Manager → Generic Credentials. Find the credentials related to your Git account and edit them to use the updated password.

Reference: How to update your Git credentials on Windows

Note that to use the Windows Credential Manager for Git you need to configure the credential helper like so:

git config --global credential.helper wincred

If you have multiple GitHub accounts that you use for different repositories, then you should configure credentials to use the full repository path (rather than just the domain, which is the default):

git config --global credential.useHttpPath true

The only thing that worked for me was navigating to C:\Users\USERNAME\AppData\Local\Atlassian\SourceTree and removing the passwd file.

Once this file is removed, restart SourceTree and execute a fetch or something else that requires access to the repo in question. SourceTree will then prompt you for your password, rewriting the cached credentials.

I hope this helps. Shoutout to my buddy Nick for the assist.

If you’re a macOS user, Auke states below that “you can find the password files per repo it in ~/Library/Application Support/SourceTree”

Git branches and tags

git branch
git branch -av
git checkout
git checkout -b
git checkout -b destination-BranchName sourceBranchName

How to keep a feature branch in sync with it’s parent branch

git checkout develop
git pull
git checkout feature/foo
git merge develop
git push

git checkout feature/foo
git pull --all
git rebase develop

Git Azure DevOps on Mac


Update the Homebrew/Linuxbrew formulae to make sure you have the latest versions:
brew update

Install the GCM4ML formula:
brew install git-credential-manager

Run the GCM4ML in install mode, which will check its requirements and then update the “global” Git configuration file (the one in your home folder):
git-credential-manager install

Create local repo
git init

Add Azure DevOps remote
git remote add origin https://

Pull from master branch
git pull origin master

Pull from Develop branch (if it exists)
git pull origin Develop

Docker commands

Pull down the SQL Server Docker Image from DockerHub
docker pull microsoft/mssql-server-linux:2017-latest

Create a Docker container using the microsoft/mssql-server-linux:2017-latest
Automatically accept the EULA, set the password to for the sa user, and map port container port 1433 to host port 1433
docker run --name sql \
-p 1433:1433 \
-d microsoft/mssql-server-linux:2017-latest

Check if the container is up (running) – in STATUS column
sudo docker ps -a

To stop the container (assuming its name is “sql”) just type
docker stop sql
Now, typing sudo docker ps -a the container STATUS is Exited

To restart the container just type
docker start sql

Test the connection with Azure Data Studio or SQLPro for MSSQL

Here there is a Microsoft Reference Guide on Docker

Deletes pulled images with IMAGE ID 810001cb03af
docker images | grep 810001cb03af | awk '{print $1 ":" $2}' | xargs docker rmi

Existing SQL Server

Generating a model from an existing database .Net Core 2.0

In a folder that will contain your demo project type the following command:
dotnet new console for a console application or dotnet new mvc for a MVC or Web API application

Add the Entity Framework Core and Tools packages to the project:
This is the EF Core provider for SQL Server.
dotnet add package Microsoft.EntityFrameworkCore.SqlServer

This package contains the Entity Framework Core commands. Both of these packages are required for any Entity Framework Core application that targets SQL Server.
dotnet add package Microsoft.EntityFrameworkCore.Tools

The final package is required for supporting the scaffolding of the model.
dotnet add package Microsoft.EntityFrameworkCore.SqlServer.Design

Test if Entity Framework is available
dotnet ef -h

Now use the DbContext Scaffold command to generate the model passing two arguments:

  • a connection string
  • a provider

dotnet ef dbcontext scaffold "Server=.\;Database=AdventureWorks;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -o Models

dotnet ef dbcontext scaffold "Server=localhost,1433\\Catalog=AdventureWorks;Database=AdventureWorks;User=SA;Password=;" Microsoft.EntityFrameworkCore.SqlServer -o Models

Once you have executed the command, you will see that a folder named Models has been created in the project folder, containing a collection of class files representing the entities.
You can find also a class file containing the DbContext class.
The DbContext class will take the name of the database plus “Context”.
You can override this using the -c or –context option e.g.
dotnet ef dbcontext scaffold "Server=.\;Database=AdventureWorksLT2012;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -o Models -c "AdventureContext"


<p><code style="display:block;white-space:pre-wrap">
using System;

namespace SingletonPatternEx
    public sealed class Singleton
        private static readonly Singleton instance=new Singleton();
        private int numberOfInstances = 0;
        //Private constructor is used to prevent
        //creation of instances with 'new' keyword outside this class
        private Singleton()
         Console.WriteLine("Instantiating inside the private constructor.");
         Console.WriteLine("Number of instances ={0}", numberOfInstances);
        public static Singleton Instance
                Console.WriteLine("We already have an instance now.Use it.");
               return instance;
    class Program
        static void Main(string[] args)                                                                                              
            Console.WriteLine("***Singleton Pattern Demo***\n");
            // Private Constructor.So,we cannot use 'new' keyword.            
            Console.WriteLine("Trying to create instance s1.");
            Singleton s1 = Singleton.Instance;
            Console.WriteLine("Trying to create instance s2.");
            Singleton s2 = Singleton.Instance;
            if (s1 == s2)
                Console.WriteLine("Only one instance exists.");
                Console.WriteLine("Different instances exist.");