Skip to content

Instantly share code, notes, and snippets.

@kolbaba
Last active February 28, 2020 21:52
Show Gist options
  • Save kolbaba/afb07cff8fbdf65451d0bc447efaffc4 to your computer and use it in GitHub Desktop.
Save kolbaba/afb07cff8fbdf65451d0bc447efaffc4 to your computer and use it in GitHub Desktop.

Basic git

git clone
git pull origin branch
git add . 
git commit ''
git push

Branching

# List Branches
git branch
# Change Branch
git checkout mybranch
# Create a branch from a branch
git checkout staging # this branch exists
git pull origin staging (confirm) # I'm assuming you do this to make sure you're working with latest
git checkout -b newbranchname # create your branch

Resolve Conflicts

# In this case we assume "stage" is the destination and "mybranch" is the source
# Source means going from, destination means go to
git checkout stage
git pull origin stage
git checkout mybranch
git merge

It will spit out where the conflicts are. You can go into your code editor on each of those pages and fix them as needed.

When done:

git add your-files
git commit -m 'fixed conflicts'
git push origin mybranch

It will then spit out a message telling you to create or see pull request.

Assorted Stuff

# Local Delete
git branch -d localBranchName

# Delete Branch Remotely
git push origin --delete remoteBranchName

# Git Reset
git reset --hard HEAD
git reset --hard origin/master

# Git Diff
git diff HEAD fileNameHere

GIT Error - (DNS Spoofing warning)

Cd ~/.ssh/
Subl known_hosts
Remove that line
~/.ssh/known_hosts

## example of dns spoofing error:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@       WARNING: POSSIBLE DNS SPOOFING DETECTED!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The RSA host key for svn-3.devcloud.hosting.acquia.com has changed,
and the key for the corresponding IP address 54.243.48.207
is unknown. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:DNeHnCQTE7hVLK0K6mRQp89wGrhydqV9VaYqgfGozA8.
Please contact your system administrator.
Add correct host key in /Users/jkolbaba/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/jkolbaba/.ssh/known_hosts:6
RSA host key for svn-3.devcloud.hosting.acquia.com has changed and you hav
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment