Source branch       
Destination branch  
Comments           
Date Time           
Local Path          
--------------------------------------------------

Unix style change directory

cd local_path

Before and after every set of scripts

git status

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

Checkin your changes

git add . git commit -m "comments" git push -u WEB TFS make a pull request to source_branch

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 git add . git commit -m "comments" git push -u

If merge gets messed up

git merge --abort

Abandon working changes

git checkout .

List local and server branches

git branch -a

Delete branch dest_branch

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

Checkout source_branch from a commit history

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

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 commit -m "comments" git push -u

Clean merge temp files (CMD)

cd c:\dev del /f /s /q *.orig 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 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-------------------------------------------------+--[DEV][QA]|[INT][STAGE][PROD]-------------------------+--[DEV][QA]|[INT][STAGE][PROD]----+--[DEV][QA]|[INT][STAGE][PROD]-- \ / | \ / | / | \ / | \--HotFix--[Local]--/ | / | \ / \ \ / \ \--Development-------------+---+--[DEVT][QAT]------------------x------------------------+------------------------------+--+--[DEVT][QAT]------------------x------------------- \ / / \ / / \ \--Story--[Local]--/ / \--Story--[Local]--/ / \--Story--[Local \ / \ / \ \--Story--[Local]--/ \--Story--[Local]--------------------------------/ \--Story--[Loc Windows Failed Auth ================================================== Control Panel -> All Control Panel Items -> Credential Manager Windows Credentials -> Generic Credentials -> git:https://xxxxxxxxxx [Remove] 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 ================================================== Add the following to your C:\Users\YOURNAME\.gitconfig file [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