Source branch       
Destination branch  
Comments           
Date Time           
Local Path          
--------------------------------------------------
Command LineVisual Studio

Before and after every set of scripts

git status

Double-Check status in the botom right menu

⇅0/0▴ 🖉0 ÿbranch▴ ⯁repo▴ ⇅0/0▴ ⇣

Unix style change directory

cd local_path

Change local repo/directory

⯁repo▴ ... -> Open Local Repository local_path

Get Latest from source_branch

git fetch origin git checkout source_branch git reset --hard origin/source_branch git pull

Get Latest from source_branch

🖉0 (Stash, Commit or UnStage any existing changes) [remotes/origin/source_branch▾] ⇣ ↓

Get Latest from source_branch and make a dest_branch branch

git fetch origin git checkout source_branch git reset --hard origin/source_branch git pull git checkout -b dest_branch

Get Latest from source_branch and make a dest_branch branch

🖉0 (Stash, Commit or UnStage any existing changes) [remotes/origin/source_branch▾] ⇣ ↓ ⋯ -> New Branch Branch name: [dest_branch] Based on: [source_branch] [✓] Checkout branch [Create]

Checkin your changes

git add . git status git commit -m "comments" git push -u

Checkin changes

🖉0 Enter a message: [comments] [Commit All▾]

Make a pull request

git config --get remote.origin.url

Make a pull request

🖉0 ⋯ -> Open in browser

Merge source_branch updates into dest_branch

git fetch git checkout source_branch git pull git checkout dest_branch git pull git merge source_branch git mergetool ``` in CMD clean the merge temp files ``` cd dos_path del /f /s /q *.orig ````````````````````````````````````````` git add . git status git commit -m "Merged source_branch into dest_branch" git push -u

Merge source_branch updates into dest_branch

🖉0 (Commit any existing changes) [dest_branch▾] ⇣ ↓ View -> Git Repository in Branches pane right-click remotes/origin/source_branch choose Merge 'source_branch' into 'dest_branch' in Git Changes view double-click conflict files to open in merge editor after conflicts back in Git Changes view Enter a message: [Merged source_branch into dest_branch] [Commit Staged▾]

If merge gets messed up

git merge --abort

Abandon working changes

git checkout .

List local and ([a]ll including server) branches

git branch -a

Delete branch dest_branch

git branch -D dest_branch git push origin --delete dest_branch

Garbage Collection

git gc

Checkout source_branch from a commit history and make a dest_branch branch

git checkout source_branch git reset --hard head git clean -f git fetch git pull git log --graph --all git checkout _______ git checkout -b dest_branch

Checkout source_branch from date time and make a dest_branch branch

git checkout source_branch git reset --hard head git clean -f git fetch git pull git checkout `git rev-list -n 1 --before="yyyy-MM-dd HH:mm" source_branch` git checkout -b dest_branch

Merge and fully Replace dest_branch code with source_branch code

git checkout source_branch git pull git merge -s ours dest_branch git checkout dest_branch git merge source_branch git add . git status git commit -m "comments" git push -u

Update GIT

git update-git-for-windows

Helpful

** What Files did I commit ** Get the Head SHA git rev-parse HEAD git diff --name-only [Head SHA] ** Remove file from the PR ** git checkout origin/source_branch -- [PATH]/[FILE] Branching ================================================== KEY (git log --graph --all) --[Server]-- ---Branch--- \ From / To --+-- Merge --x-- Reset | Label Label 1.1.0 Label 1.1.1 Label 1.2.0 Master-----------------------------------------------+--[INT][STAGE]-[PROD]-------------------------+--[INT][STAGE]-[PROD]--------------+--[INT][STAGE]-[PROD]----------- \ / | \ / | / | \ / | \--HotFix--[Local]--/ | / | \ / \ \ / \ \--Development-------------+---+--[DEV][QA]---------------------x------------------------+---------------------+--+--[DEV][QA]---------------------x---------------- \ / / \ / / \ \--Story--[Local]--/ / \--Story--[Local]--/ / \--Story--[Lo \ / \ / \ \--Story--[Local]--/ \--Story--[Local]-----------------------/ \--Story--[ Windows Failed Auth ================================================== Control Panel -> All Control Panel Items -> Credential Manager Windows Credentials -> Generic Credentials -> git:https://xxxxxxxxxx [Remove] Aliases ================================================== origin = remote repo master = local repo HEAD = current master committed staged = files watched sub modules = nested git repos sync = visual studio pull and push Use ================================================== new local repo git init status of repo git status add [file] to stage git add "[file]" (*.txt) . : all the files in current directory remove [file] from stage git reset "[file]" commit staged changes to master git commit -m "[comment]" -m : message list commit history git log add master to origin stage git remote add origin [remoteUrl.git] push master to stage git push -u origin master -u : remember params for next 'git push' pull changes from origin to master git pull origin master is fetch and merge diff origin to HEAD git diff HEAD diff origin to master staged git diff --staged checkout to a branch git checkout [branchTitle] -- : filePath not branchTitle -b : make branch and checkout to it view branches git branch make branch git branch [branchTitle] -d : delete branchTitle -D : force delete -a : list local and remote branches remove file from disk and stage git rm "[file]" merge from branch to current git merge [branch] from HEAD merge master to one history git rebase master list tracked repos git remote -v -v : verbose Clone a repo to a new directory git clone Manage set of tracked repos git remote prune origin git push -u Tools ================================================== gitk --all& load kitk on sub thread git log --graph console version of git flow use VS for mergetool ================================================== ``` in CMD find vsDiffMerge.exe ``` cd c:\ dir /b /s vsDiffMerge.exe ``````````````````````````````````` git config --global --edit ``` [diff] tool = vsdiffmerge [difftool] prompt = true [difftool "vsdiffmerge"] cmd = \"c:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe\" \"$REMOTE\" \"$LOCAL\" //t keepbackup = false trustexistcode = true [merge] tool = vsdiffmerge [mergetool] prompt = true [mergetool "vsdiffmerge"] cmd = \"c:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe\" \"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\" //m keepbackup = false trustexistcode = true ```