Monday, August 13, 2018

GIT Tips


##### To include (e.g. "add") in what will be committed
git add 

##### Determine your current branch and display local branches
git branch

##### CREATE a new local branch and switch to it
git checkout -b 

Where "BN" is a branch name like "engineer-feature-YYYYMMDD-xx" or "engineer-task-YYYYMMDD-xx"
NOTE: git apparently doesn't like like branch names with leading "/" characters
NOTE: in the examples above, the "xx" might represent a sequence # (which may be overkill)

##### SWITCH to an existing branch using checkout command
git checkout 

Where "BN" is a branch name like "engineer-feature" or "engineer-task"

##### To discard changes in the working directory to an individual file
git checkout --  

##### To commit to current branch with comment
git commit -m ""  

##### To show commit history on a branch, use variations of this base command
git log 

##### To merge from one branch to another, use this base command
git merge 

##### To push local branch up to the origin repo, use this base command
git push

##### To remove files from the Git index
git rm --cached 

##### Determine your Git status (what branch, untracked files, etc.)
git status