Learning-Git-and-GitHub

General Git Notes

Topic Command Note Example Date/Time Source
Clone branch git clone git clone [url] 8/9/17 https://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository
Test branch creation
git fetch
git checkout devevlop
git merge origin/develop "/" - local" " - remote
git checkout -b <branch_name> note: no_spaces
Work is completed
git add <file_name>
git commit -am "<branch_name>:"
git push origin <banch_name>
Work is finished. Develop is merged into test branch.
git fetch
git checkout <branch_name>
git merge origin/develop
RESOLVE CONFLICTS
i. git status
ii. (resolve unmerged changes)
iii. git add merged_files
iv. (repeat as necessary)
v. git commit -am "<branch_name>:"
Test to insure integration was successful
Push to remote for code review and to create Pull Request
a. git push origin <branch_name>
b. go to https://github.com/KainosSoftwareLtd/evolve.intouch.health/branches
c. select your branch
d. click "Pull Request" button
e. enter description is helpful, set a Label, set Assignees: mattgreenfield1, Eadrin, mschielmann, mackin153, adammackenzieka...
f. click "Create Pull Request"
g. audit github messages for update as P1 & P2.
h. follow up in slack or scrum
Code review changes are made as necessary
a. make sure Develop is merged into <branch_name>
b. make sure test runs green
c. git push origin <branch_name> (this will automatically update the Pull Request with changes)
Pull Request is approved and merged to Develop
a. open Pull Request and click "Merge Pull Request" buttonhttps://github.com/KainosSoftwareLtd/evolve.intouch.health/pulls
b. enter descriptive summary message
c. click "Confirm Merge" button
How to pull remote branch to your local machine (for code reviews)
1. fetch remote branch list a. git fetch b. git checkout deployment c. git merge origin/deployment
2. Create local branch that tracks the remote branch a. git branch --track origin/
3. Switch to local branch a. git checkout
rename a branch 1. Rename your local branch. If you are on the branch you want to rename: git branch -m new-name2. Delete the old-name remote branch and push the new-name local branch. git push origin :old-name new-name3. Reset the upstream branch for the new-name local branch. Switch to the branch and then: git push origin -u new-name 8/31/17
git log git log cntl z 8/31/17
git remote url git remote get-url origin 9/12/17 https://stackoverflow.com/questions/4089430/how-can-i-determine-the-url-that-a-local-git-repository-was-originally-cloned-fr
git process for creating a branch for inspecting a PR https://stackoverflow.com/questions/27567846/how-can-i-check-out-a-github-pull-request
git fetch origin pull/ID/head:BRANCHNAME where ID is the pull request id and branchname is the name of the new branch that you want to create.
git checkout BRANCHNAME now checkout the branch, run, make local changes that can be merget

Lynda.com Class ~8/1/2017

Learning-Git-and-GitHub

Prerequisites

  1. Reccomended IDE: Visual Studio Code >= 1.10.2

  2. Install Node.js

    Use Node >= v7.7.1 and npm >= 4.1.2

  1. Set npm registry:

    npm config set registry https://registry.npmjs.org

    Refer to these instructions on how to not require sudo

gitignore

gitignore example wild cards