Simple examples of deploying code to your application using Git

Web Development GitHub Simple examples of deploying code to your application using Git

Deploying code can seem daunting, but it doesn't have to be. This article will guide you through the basic process of deploying your code to an application using Git. We'll cover simple, practical examples to help you get started.

Cloning GitHub repository to local repository

cd c:/www/site
git clone https://github.com/user-name/website-repository -b master

Creating own branch

git checkout -b my-branch

Pull branch form origin repository

git pull origin master
git pull origin master my-branch

// OR

git fetch origin
git reset --hard origin/master	

Switching between branches

git checkout my-branch
git checkout master
git checkout dev

Commit changes to files

git status
git add .
git commit -m "My changes"

Send changes to the GitHub repository

git push origin my-branch

Join branches

git checkout master
git pull origin
git checkout my-branch
git merge master

Cancel Last Pull

git reset --hard HEAD@{1}