Skip to content

Latest commit

 

History

History
182 lines (123 loc) · 4.53 KB

workshop2.md

File metadata and controls

182 lines (123 loc) · 4.53 KB

S-DOEA - Workshop 1 - Github Workshop

Pre-requisites

For mac users please use brew

Homebrew (http://brew.sh/) is another alternative to install Git. If you have Homebrew installed, install Git via

brew install git

Instructions

  1. Create/Sign up for a Github account


  1. Create a working directory on your machine
mkdir Projects

cd Projects

mkdir ProjectA

cd ProjectA

  1. Initialize the working directory as git enable project
git init
  1. Go to the Gitlab dashboard, add a new repository


  1. Create a repo on Github, do not initialize README.md


  1. Associate the local working directory with the remote repository
git remote add origin https://github.com/<your github username>/ProjectA.git


  1. Issue the following command to to verify the association is correct
git remote -v

origin	https://github.com/<your github username>/ProjectA.git (fetch)
origin	https://github.com/<your github username>/ProjectA.git (push)
  1. Create a README.md documentation as the initial file for your newly created repository
echo "# ProjectA" >> README.md
  1. Create a html file index.html file with following content place on the project A directory
<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

</body>
</html>
  1. Add the files to the staging index
git add .
  1. Confirm all the changes made to the working directory and ready to commit to the remote repository by issuing the following command. argument -m is comment to every check in of the source codes.
git commit -m "new"
  1. Check in the changes to the remote repository
git push origin master

Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 510.18 KiB | 17.59 MiB/s, done.
Total 7 (delta 4), reused 0 (delta 0)
remote: Resolving deltas: 100% (4/4), completed with 4 local objects.
To https://github.com/<your github username>/ProjectA.git
   84e356d..b6c5251  master -> master
  1. Verify all the files are pushed to the github repo after the above steps. Use your browser navigate to the https://github.com/kenken64/ProjectA.git (replace the github userid with yours)

  2. Next on your terminal/command prompt let us create a branch in git.

git checkout -b enhancementA
  1. In order to check the current branch run the below command, the terminal should see * pointed to the newly created branch name
git branch
  1. Create a new file for this this newly created branch, index2.html
<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

</body>
</html>
  1. Add the new file created for the new branch to the remote repository
git add .
git commit -m "new enhancement"
git push origin enhancementA -u
  1. Navigate to the project A github url https://github.com/kenken64/ProjectA.git check the branch is created. (Replace the github userid with yours)

  2. Create a pull request for your newly created branch

  1. Merge your newly created branch with your master branch.

** Whenever there is new files created or any changes to the current codebase if the developer would like to check in their codes please run step 8,9,10 again. For those of you not very comfortable with command line there are many IDE Git integration software out there. See below screen capture for Visual Studio Code Git Plugin. Also Git GUI Standalone software by Atlassian https://www.sourcetreeapp.com/



For branching, tagging and etc please visit the following link https://github.com/kenken64/NUSISS-DevOpsEng/blob/master/git/README.md

Reference