Skip to content

Latest commit

 

History

History
81 lines (56 loc) · 1.37 KB

File metadata and controls

81 lines (56 loc) · 1.37 KB

ReadMe

Collection of useful commands related to Git

Initialize Git repo for the first time

$   git init

Add all content for tracking in the branch

$   git add .

Commit with message

$   git commit -m "Initial Commit"

Create new branch

$   git branch phase1

Change branch to work in differet one

$   git checkout phase1

Add Remote branch

$ git remote add learningGo https://github.com/bootstrapsp/learningGo.git

Push all to the remote branch

git push --set-upstream learningGo phase1

Pull all updates from remote branch

git fetch --all

Discard all local changes and merge all updates fetched from remote branch

git reset --hard origin/development

Pulling all the changes from the the remote repo

git pull

Following used for syncing the github's repo with Bitbucket by adding it to the remote list

git remote set-url learningGo  --add https://bootstrapsp@bitbucket.org/rajtheceo/learninggo.git

To merge a branch with master

git merge phase3

Note: this should be executed from master branch, i.e. prior to this do git checkout master to change the branch

Then push to master for final merge

git push --set-upstream --force learningGo master

Note: here learningGo is remote repo name