Source Control
Tools > Options - Source Control tab
Plug-in selection tab
SS
Solution.suo
Solution User Options
Binary file containing the solution user options (inc startup project(s), window positions etc)
This is a hidden file by default
This should not be checked in to your source control
TFS does not check this file in.
project.csproj.user
Project User Settings
Text file containing specific project settings
This is a hidden file by default.
This should not be checked in to your source control
TFS does not check this file in.
Git
To change the default folder, right click on the GitBash Application icon and select Properties
GitBash is a Git client
Overview
Git is a version control system for tracking changes to files and coordinating these changes to other people.
Its main use is for source code management in software development.
Git is the version control software
Github is a git repository hosting service which incorporates all the features of git.
Bug Fix Code (new branch)
cd c:\temp
cd GIT_Working/
git clone -b existingbranch "paste URL"
cd projectname
<< make code changes >>
git status
git add --all
git status
git branch branch-name201-15
where the version number is 2.0.1 and the build version is 1.5
git checkout branch-name201-15
git commit -m "comment / JIRA ref"
git push origin branch-name201-15
Clean the solution from any debugging before removing it from GIT_Working
Staying on the feature branch
When you push you can include the "-u" switch to stay on the new branch
This helps it stay in sync and stops it from jumping back to "master" after the push
git push -u origin branch-name201-15
Save More Changes (same branch)
By default, Git chooses "origin" for the remote.
By default, Git chooses your "current branch" as the branch to push.
git status
git add --all
git status
git commit -m "comment / JIRA ref"
git push
Adding a JIRA to the comment after trying once
git commit --amend -m "JIRA ref"
Remove old branches
git branch --all //see all the branches
git push origin --delete branch-name201-15 //delete a remote branch
Get the latest changes (into an empty folder)
cd myfolder
git init
(optional) git remote add "remote_name" "copy the URL from the clone button in the UI"
git pull remote_name "branch_name"
git remote rm remote_name
git pull remote_name master
git pull remote_name feature/ribbonUI
Get the latest changes (overwrite local changes)
cd myfolder
git init
(optional) git remote add "remote_name" "copy the URL from the clone button in the UI"
git fetch remote_name "branch_name"
git reset --hard ********* (last commit)
Integrate the latest remote changes
git pull remote_name branch-name201-15
Reset all your Local Changes
git reset --hard remote_name/branch-name201-15
Switching branches
git checkout develop
git checkout branch-name201-15
Check in my changes
cd myfolder
git init
git add --all
git status
git commit -m "RESAUTH-"
git push -u remote_name branch-name201-15
Delete a Folder recursively
git rm -r foldername
New Repository
When you need to create the repository and upload for the first time.
cd c:\temp
cd myfolder
git init
git add --all
git commit -m "Initial Commit"
git remote add origin "paste URL"
git push -u origin master
Replace/Add all the modified files
clean the Visual Studio solution
replace all the files
delete the bin sub folder
delete the obj sub folder
remove the packages folder
remove the "suo" file - solution user options
If a file has been modified you must run "git add" to ensure the latest changes are in the staging area
1) Can you describe the four different areas ?
Working Directory - This is a local folder on your device. Using "git add" moves changes to the Staging Area.
Staging Area - Using "git commit" moves changes to the Local Repository.
Local Repository - This contains all your commits. Using "git push" moves changes to the Remote Repository.
Remote Repository -
2) Can you describe the three different states for files in the Working Directory ?
using "git status" tells you what is going on here
Untracked files -
Tracked, Unmodified -
Tracked, Modified -
3) What is the difference between a remote branch and a local branch ?
A remote branch represents the version that is on the server
A local branch represents the version that is saved locally
4) What does the git clone command do ?
A new folder is created which is the same name as the repository
All the files are pulled down from the remote repository
Creates a '.git' sub folder
A remote called "origin" is created referencing the URL
A local branch called 'master' is created ??
If no explicit branch is given then the repository 'default branch' will be pulled.
The local branch 'master' is also a tracking branch that tracks 'origin/master'
git clone ""paste the URL""
git clone -b mybranch ""paste the URL""
5) What does the git checkout command do ?
This command is used to move around in the commit tree and moving your HEAD label.
This command will only change things in your local repository.
If your local repository does not have all the latest changes then you need to perform a 'git fetch' first.
You can move the HEAD label in lots of different ways
git checkout branch_name
git checkout HEAD^
git checkout HEAD~1
git checkout -b branch_name // creates a new branch and moves to that branch
6) Write code to get all the latest changes (into an empty folder)
git remote add <remote_name> <paste the URL from the clone button in the UI>
git pull remote_name branch_name
git pull remote_name master
7) Write code to get all the latest changes (overwrite local changes)
git fetch remote_name branch_name
git reset --hard // reset to the last commit
git reset --hard <last commit>
8) What does the git log command do ?
This gives you a summary of all your commits.
9) Write code to check-in your latest changes ?
git add --all
git status
git commit -m "my comment" // the m switch allows you to add a comment
git push origin branch_one
10) Write code to switch to a different branch ?
git checkout master
git checkout feature/branch_one
11) Write code that displays all the local and remote branches ?
git branch --all
git branch // only local branches
git branch --remote // only remote branches
12) Write code to delete a local branch ?
git branch --delete local_branch_name
If the branch is not fully merged you need to run
git branch -D local_branch_name
13) Write code to delete a remote branch ?
git push origin --delete feature/oldfeature
If you delete a remote branch, the corresponding local branch is removed automatically.
14) Write code to delete a folder recursively ?
git rm -r foldername
15) What is a 'tracking branch' ?
A tracking branch is a local branch that automatically tracks and refreshes when changes are made on the remote branch.
In this context the remote branch is called an upstream branch.
16) What is the HEAD ?
This is a label that refers to the currently active head in your repository.
This moves with you from one commit to the next.
The HEAD usually points to the last commit for a particular branch.
17) Write code to remove an existing Remote Name
git remote rm remote_name
18) Write code that will throw away all my local changes and sync it with what is on the remote server
git reset --hard origin/branch_one
19) What does the command ls -a command do ?
This shows all files including the hidden ".git" folder.
20) What is the base branch ?
This is a branch that others are being compared to.
21) What is the default branch ?
This is the branch that operations will be made on if you do not explicitly provide a branch name.
22) Write code to compare the files in the working directory with the files in the staging area ?
git diff
23) Write code to compare the files in the staging area with the files in the local repository ?
git diff --staged
24) Write code to create a local branch ?
git branch feature/newfeature
25) Write code to see the difference between a local branch and a remote branch ?
git diff develop remote_name/develop
26) Write code to merge the latest 'develop' changes to a feature branch ?
git fetch remote_name
git checkout feature/myfeature
git merge develop
27) Write code to merge a feature branch to the 'develop' branch ?
git fetch
git checkout develop
git merge feature/myfeature
28) What does the 'git pull' command do ?
This command provides a shortcut to the following two lines of code.
Using the pull will not submit a merge commit
git pull develop
// equivalent to
git fetch develop // get all the latest information about all the branches on the remote server, no actual code
git merge develop // updates you local working copy and submits a merge commit
29) What does the 'git push -u' command do ?
It provides a shortcut to the following line of code
git push --set-upstream
This adds an upstream tracking reference
30) What does the 'git fetch --prune' command do ?
This will refresh your local copy of all the remote branches.
If any branches have been removed from the server they will be removed from your local copy.
git fetch --prune
31) What does the 'git revert' command do ?
This command can be used as a way of returning to a previous commit.
This can reverse the effect of earlier commits.
git revert -m 1 "commit id"
32) Is it possible to merge a branch with itself ?
Yes. Every merge will send a merge commit even when the merge has no changes.
33) What is 'VIM' ?
This is a command line text editor that can be used on any platform, windows, apple and unix
<esc>:wq<enter> // save and quit
git add
git add "file_name.txt"
This will add this file to the staging area so it can start to be tracked
git add "directory_path"
This will add all the files in this directory recursively
git add .
This will add all new and modified (not deleted) files to the staging area
git add -u
This will add all modified and deleted (not new) files to the staging area
git add -A
git add --all
This will add all new, modified and deleted files to the staging area
git branch
git branch
This will tell you which branch is currently active
git branch "branch_name"
This creates a new branch called "branch_name"
git branch -d "branch_name"
??
git checkout
git checkout <filename.txt>
This will delete any changes and restore the file back to the last checked in version in your local depository
git checkout "branch_name"
This will switch to the branch called "branch_name"
git checkout -b "branch_name"
This is shorthand for:
git branch "branch_name"
git checkout "branch_name"
git checkout -f
This will remove all your changes
git cherry
git cherry pick
?? relating to GUID of previous commits ??
git clone
git clone https://github.com/blah/blah
This pulls out a copy from the remote repository to your local repository and checks out a working directory
git commit
git commit -m "my comment"
This will commit the local changes in the staging area to the local repository
git commit -am "my comment"
This will commit the local changes to the local repository
This is shorthand for:
git add .
git commit -m "my comment"
git diff
git diff
This will compare the files in the working directory with the files in the staging area
git diff --staged
This will compare the files in the staging area with the files in the local repository.
git fetch
git fetch
This will update your local git repository with any changes that are new on the server
git gc
??
git init
git init
This will initialize your working directory.
git log
git log
This displays a list of all the changes that have been committed in the corresponding order press "q" to exit this log
git log --oneline
This displays a list of all the changes that have been commited, condensed to one line per change
git merge
git merge
??
git push
git push -u "remote_name" "branch_name"
This will push the changes in your local repository to the remote repository
git pull
git pull "remote_name" "branch_name"
This will pull changes from the remote repository to your local repository
git pull --rebase
The rebase options tells Git to move all the commits to the top of the branch after synchronising it with the changes from the central repository
git rebase
git rebase --abort
??
git rebase --continue
??
git remote
git remote add "remote_name" "remote_location"
This adds a relationship between a remote_name and its corresponding remote_location The remote is only known as used locally
git remote rm "remote_name"
This will remove a particular remote
git reset
git reset HEAD filename.txt
This will remote a file from the staging area
git reset --hard origin/master
Throw away all my stages and unstaged changes and ignore everything in my local branch.
Make my local branch exactly the same as the remote repository
git reset --soft HEAD~1
??
git status
git status
This will tell you what the current status is for the project
git status -s
Provides a short compact status for the project
vim ??
??
Rebaising
There are two main ways to integrate changes from one branch into another - the merge and the rebase
Online References:
link - try.github.io/levels/1/challenges/1
link - git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository
link - confluence.atlassian.com/bitbucketserver/basic-git-commands-776639767.html
link - confluence.barcapint.com/display/RnADevOps/Set+your+local+Git+configuration
.gitignore
Save this file in the top level folder.
# Nuget packages
*.nupkg
*.nuget.props
*.nuget.targets
*.suo
*.user
*/bin
*/obj
# No binaries
*.dll
# Build Results
[Dd]ebug/
[Rr]elease
[Bb]in/
[Oo]bj/
packages/
# Visual Studio cache/options directory
.vs/
.vscode/
# Internal directory
ClickOnce/
© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext