onlyforbopi
12/7/2018 - 12:45 PM

GIT - GITHUB

  1. Initialize new Git Repository with Remote Github
  2. Commit changes to Repository
  3. Fix : Repository Not Found
# This requires git installed. 

# First right click on the folder you want to create a repository for
# and click "Open Git Bash".

# Secondly : Go to your home page in Github - > New Repository + Create
# Copy the given link. We will use it here.

# Initialize new repository of the chosen folder
git init

# Add the files you wish to track, you can either do this one by one ie
# git add <file_1>
# git add <file_2>
# or add them all with .
git add . 

# Stage the commit and give it a name
git commit -m "Initial Commit"

# Add the remote URL from github as origin
git remote add origin https://github.com/onlyforbopi/FileGroupingSplitter.git

# Push the changes on github
git push origin master

# Check for changes on tracked folder
# If we have changes, or untracked files it ll report
git status

# To add the changes to new staging
git add <filename> #or
git add .

# To push changes to github and git
git push origin master

# It will ask for github pass
# Repository not found or repository already exist
git remote set-url origin https://github.com/onlyforbopi/NewNewNewNew.git
# Flow

<initiate repository>
<add files to staging area>
<commit>
<make changes to files>
<check status of uncommitted edits>
<add files to staging>
<commit>
<check log>
<check status>

# Commands

git init                       # Initiate new repo
git status                     # Status of repo - uncommited edits
git log                        # List of all versions / Commits
git add                        # Add files to staging
git commit -m                  # commit changes to repository
git checkout                   # git checkout <repo-name> will change the context to that repo (Use git log for the hash)
git reset <hash>               # Will return the state of the repo to the current version (dangerous)
git checkout master            # Return to master after checking a repository
git checkout -b "newbranch"    # Use instead of git reset, branch current state into new branch of development
git checkout master            # Return back to master
git branch (-a/-r)             # List all branches

# Basic Workflow for local - no branching development
<command> #explanation
git log 
git status
git add .
git commit -m "msg1"
git status
git log
# make changes 
git add .
git commit -m "msg2"


# Open git bash in directory (rlick/git bash)
git log             # shows log of commits
git status          # shows current status of unsubmitted edits
git add .           # or git add <fname>
git commit -m "msg" # commit
git log      



# Basic Workflow for local - with branching development
<command> #explanation
git log 
git status
git add .
git commit -m "msg1"
git log
git status
# make changes
git add .
git commit -m "msg2"
git log
git checkout <firstcommithash>
git checkout -b "new branch"
# start separate dev thread on new branch
git checkout master

# Master Branch - Just like example 1

# Master Branch - Check previous version then return to master

# Return to previous version - branch out - and separate dev thread.