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 myfolder
cd 'my folder'
git clone -b existingbranch "paste URL"
cd projectname
<< make code changes >>
git status
git add --all
git status
git branch feature/newfeature
git checkout feature/newfeature
git commit -m "comment / JIRA ref"
git push origin feature/newfeature

Clean the solution from any debugging before removing it from Git Local


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"
git push

I don't think the following line is required (maybe useful if there is a problem)

git push -u origin "feature/samefeature" 

Remove old branches

git branch --all   //see all the branches 
git push origin --delete feature/oldfeature //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 feature/ribbonUI 

Reset all your Local Changes

git reset --hard remote_name/feature/ribbonUI 

Switching branches

git checkout develop 
git checkout feature/ribbonUI

Check in my changes

cd myfolder 
git init
git add --all
git status
git commit -m "RESAUTH-"
git push -u remote_name feature/ribbonUI

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


© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited TopPrevNext