universelabs / universe

Decentralized private key recovery
https://universe.engineering
MIT License
13 stars 1 forks source link

Setup simple command line & git reference for beginners #16

Closed guylepage3 closed 5 years ago

guylepage3 commented 5 years ago

Description Setup simple command line & git reference for beginners. Such as designers, marketers, etc.

Documentation tasks

guylepage3 commented 5 years ago

New Document for on-boarding for designers, marketers, etc. https://docs.google.com/document/d/1KPinMXQ4a1fOGWKb6SA1Iv2kRkF0fVDtDQEMtQZRNro/edit?usp=sharing

guylepage3 commented 5 years ago

Command Line, Bash, Script and Git References (For macOS)

1.0 Bash and/or Terminal Shell Commands and Script References

Reference: Terminal Mac Cheatsheet -- https://github.com/0nn0/terminal-mac-cheatsheet

Terms & Terminology

Terms Definitions Directory A directory is a folder. Fork (software development) In software engineering, a project fork happens when developers take a copy of source code from one software package and start independent development on it, creating a distinct and separate piece of software. Branch (Branching [version control]) Branching, in revision control and software configuration management, is the duplication of an object under revision control (such as a source code file or a directory tree) so that modifications can happen in parallel along both branches. Bash Alias A Bash alias is essentially nothing more than a keyboard shortcut, an abbreviation, a means of avoiding typing a long command sequence.. Git Git is a distributed version-control system for tracking changes in source code during software development. GitHub GitHub is a web-based hosting service for version control using Git. git-flow (AVH Edition) git-flow-avh is a set of git extensions to provide high-level repository operations for Vincent Driessen's branching model. (AVH is a fork of the original git-flow model and adds more functionality than the original). Command prompt ( > or $ ) In Windows, it is the greater-than sign: > ; in macOS and Linux, it is a dollar sign: $ . Regardless of which operating system is being used, coding instructions sometimes indicate a command by preceding it with the dollar sign. The dollar sign is not typed as part of the command.

Bash or Terminal Shell Commands

How to run a command in Terminal using the command line interface To run a command line command you simply type or paste in the command into a new Terminal app window and then hit enter.

Example:    $ cd   + Enter moves the user to the user’s Home directory on their machine.

Commands Results $ This is the command prompt for Linux and macOS. If you ever see the dollar sign at the beginning of a command, it is to be ignored. Example: $ brew install git Sound be interpreted as: brew install git $ help Lists all GNU bash shell commands. $ cd Moves user to the user’s Home directory. $ cd ../ Moves the user back one directory. $ cd Documents/sites/[project] Moves the user to Documents/ directory then to the sites/ directory and then to the project/ directory. $ ls Lists the directory’s files and subdirectories that you are in. $ -la Lists the directory’s hidden files and subdirectories and that you are in. $ ls -la Lists the directory’s files and subdirectories and the directory’s hidden files and subdirectories and that you are in. $ clear Clear’s the Terminal window. $ pwd Shows current working directory/path. $ rm -rf Delete directory and all it’s files.. $ git checkout [branch] Switches to branch. $ git status Displays the status of files/directories. $ git add . Adds all changed files & directories that have been modified to staging. $ git commit -m ‘[message describing changes]’ Commit your changes with a descriptive message.

VIM Editor Commands

Press control + C then enter $ :wq Exit VIM editor and commit message (NEW MacBook Pro). Press esc then enter $ :wq Exit VIM editor and commit message. Press control + C then enter $ :q Exit VIM editor without committing (NEW MacBook Pro). Press esc then enter $ :q Exit VIM editor without committing.

Advanced Commands (DO NOT USE)

$ git push origin [branch] Pushes branch to origin (GitHub). $ git rm -r --[directory] Removes folder from stage. $ git add -u Removes all [deleted:] files from stage. $ git checkout -b [Branch Name] Create a new branch named "xyz" and switch to it using. $ git reset --soft HEAD^ To delete a commit one instance back $ workon To view the current environment

2.0 Developer Tools and Setup

The following is a list of on-boarding and setup instructions.

Developer Tools and Setup

Terminal.app (comes installed with macOS) Homebrew Homebrew installation instructions Git Install git by running $ brew install git in Terminal. Setup Git for first time - Instructions git-flow (AVH Edition) Install git-flow by running $ brew install git-flow-avh in Terminal. Initialize git-flow - Instructions (scroll down to “Initialize”). Note: git-flow needs to be initialized locally on your machine every time you clone a repository Code editor or IDE (ie. Sublime Text, Visual Studio Code, Brackets, etc.) GitHub (remote code hosting service) Create a new GitHub account Once created, DM your manager in Slack with your GitHub username.

3.0 Workflow

We develop our applications using a common workflow.

Clone repository to your local machine from GitHub using Terminal. Initialize git-flow using Terminal. In Terminal, create your new branch using the git-flow model. Run $ git branch to verify that you are currently on master the branch. Run $ git checkout -b develop to create the required develop the branch. Run $ git checkout develop to move to the develop branch. Run $ git flow feature start [name of new feature] to create the [name of new feature] branch. Run $ git branch to verify that you are currently on [name of new feature] branch. Run $ git push origin feature/[name of new feature] to push your branch to GitHub’s servers. You are now ready to start coding on the correct branch. Add code to your Code Editor or IDE. Edit and Save some code using your Code Editor or IDE. Create your Commit your changes Open Terminal Run $ git status Run $ git add . Run $ git status Run $ git commit -m ‘[message describing the code changes]’ Run $ git status Push your changes to GitHub’s servers. Open Terminal Run $ git status to verify that there is nothing in staging. Run $ git push origin feature/[name of feature] Finish your feature using the git-flow model. Open Terminal Run $ git status to verify that there is nothing in staging. Run $ git flow feature finish [name of new feature] to create the [name of new feature] branch. Run $ git push origin develop. This will delete your feature branch for you, push and automatically merge your code changes into the develop branch.

3.1 Commit code changes

Once you’ve setup your work environment, you will want to now make changes to your code, save those changes and then start committing your changes in smaller chunks.

How to commit changes you’ve made to your code git status Displays the status of files/directories. git add . Adds all changed files & directories that have been modified to staging. git status To check and make sure all files/directories have been staged. They will appear Green in color if staged correctly. If there are any red after this step, please message me. git commit -m ‘[message describing changes]’ Commit your changes with a descriptive message.

After completing an entire stage After you finish the hero section please message me on Slack.

4.0 Terminal Shell Environment Setup

Bash Alias Setup

Now that you’re getting more familiar with working on the Command Line in Terminal, you may now start adding Bash Alias’ In order to speed up your workflow.

NOTE:   Make sure you know all the general commands before creating and using aliases.

alias Lists all bash aliases you’ve created on your in your Terminal App.. alias [new command]='[command set]' An example of how to create an alias to simplify command line commands. Examples: alias cls='clear' alias gst='git status' alias gad='git add .' alias spotify='open -a Spotify.app' alias applications='open ../../'

alias Shows all aliases you’ve created.

guylepage3 commented 5 years ago

Would love to get some comments on this document. cc @faddat @dantrevino @modkaffes Thanks.

modkaffes commented 5 years ago

Hey @guylepage3. Great list! Wish I also had such a list when I was starting out as a dev, instead of having to search everything by hand 😀

I have a few minor observations regarding the linked pdf (I don’t have access to the google doc):

guylepage3 commented 5 years ago

Ugh. Google Docs is terrible for opening up their docs.. How about now. Can you read and comment on the doc? https://docs.google.com/document/d/1KPinMXQ4a1fOGWKb6SA1Iv2kRkF0fVDtDQEMtQZRNro/edit?usp=sharing

guylepage3 commented 5 years ago

@modkaffes you should be able to comment in the doc now. Please let me know if you cannot. Once you comment in the document, I'll update it from there. Thx. :)

modkaffes commented 5 years ago

@guylepage3, yep, I’m in. Thanks!

guylepage3 commented 5 years ago

Done