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


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