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

How to ignore files (untrack) that have already been committed to GIT repository

If your GIT repository is tracking files that you want to ignore (i.e. you init your repo without .gitignore file) then these files still be present in you repository index also after adding them to the just created .gitignore file.

Step 1 – Create (or modify) .gitignore file

If you need an helping hand go to (for csharp

Step 2 – Commit all your changes

After .gitignore file has been saved, commit all you files, including your new .gitignore file.
git commit -m “Fixed .gitignore issue.”

Step 3 – Remove everything from the repository

Clear your repo by using:
git rm -r –cached .
rm is the remove command
-r will allow recursive removal
–cached will only remove files from the index. Your files will still be there.
The . indicates that all files will be untracked. You can untrack a specific file with git rm –cached foo.txt (thanks @amadeann).
The rm command can be unforgiving. If you wish to try what it does beforehand, add the -n or –dry-run flag to test things out.

Step 4 – Re-Add everything

By using
git add .

Step 5 – Commit

By using
git commit -m “.gitignore fix”

Step 6 – Push

Push the changes to your remote to see the changes effective there as well.
git push

Useful .gitignore template: