fatal: refusing to merge unrelated histories solution: git...

45
fatal: refusing to merge unrelated histories solution: git pull origin master --allow-unrelated-histories https://www.youtube.com/watch?v=HVsySz-h9r4&index=1&list=PL-osiE80TeTuRUfjRe54Eea17-YfnOOAx https://www.youtube.com/watch?v=HVsySz-h9r4 https://www.youtube.com/watch?v=iCGrKFH2oeo Simple startup create a new repository on the command line echo "# Test" >> README.md git init git add README.md git commit -m "first commit" git remote add origin https://github.com/wave-inguane/Test.git git push -u origin master push an existing repository from the command line git remote add origin https://github.com/wave-inguane/Test.git git push -u origin master 1 IN Project dir DO NOT: add initial files in remote repo :git init Initialize an empty repo :git touch README.md Create README markdown file :git vim README.md Edit

Transcript of fatal: refusing to merge unrelated histories solution: git...

fatal: refusing to merge unrelated histories

solution: git pull origin master --allow-unrelated-histories

https://www.youtube.com/watch?v=HVsySz-h9r4&index=1&list=PL-osiE80TeTuRUfjRe54Eea17-YfnOOAx

https://www.youtube.com/watch?v=HVsySz-h9r4

https://www.youtube.com/watch?v=iCGrKFH2oeo

Simple startup

create a new repository on the command line

echo "# Test" >> README.md git

init

git add README.md

git commit -m "first commit"

git remote add origin https://github.com/wave-inguane/Test.git git

push -u origin master

push an existing repository from the command line

git remote add origin https://github.com/wave-inguane/Test.git

git push -u origin master

1 IN Project dir DO NOT: add initial files in remote repo

:git init Initialize an empty repo

:git touch README.md Create README markdown file

:git vim README.md Edit

:git status View repo current status

:git add README.md

:git add -A

Add all files

:git status

:git commit –m ‘what and why’

Remove just Added files

:git reset filename

:git reset Remove all added files

:git log Verify the commit

:git remote add origin repo-full-path

DONE ONCE PER REPO

:git remote -v Double check if ready for push

:git pull origin master

:git push –u origin master

:git

:git Dependency

:git pull https://github.com/thomas07vt/M yFirstRepo.git

Note: do not add an files in remote repo master

Create files that will not be traced

:touch .gitignore Add all file names to be ignored by git

:vim .gitignore

CLONE PROJ

:git clone <from git url> <to local dir> . => current dir

:git diff See changes made

BRACH

S

[copy of original code or project]

:git branch <branch name> Create a branch

:git branch List all existing branmchs

:git checkout <branch name to work on > Make branch active

PUSH BRANCH to MASTER REPO

:git push –u origin branch name Push to master repo

:git branch -a Display all our branchs

MERGE BRANCH TO A MASTER

:git checkout master Switch to mater branch

:git pull origin master Always pull the master before each

push

:git branch --merged List of Merged branchs

:git merge branch name

:git push origin master

DELETE NO LONGER NEEDED B RACH

:git branch --merged

:git branch –d branch name

:git branch -a

:git push origin – delete branch name Delete from remode

DELETE A FILE

:git rm filename Delete from local repo ( ex: hard drive)

Delete from remote repo (web)

:git commit -m “removed xyz”

:git pull

:git push

DONE: refresh git on web

:git reset HEAD filename Use this after add and before commit

REMOVE REPO

:git rm –rf .git

ADD ALL CHANGES MADE

:git add -A Add all changes

NEXT commit –m “---“

MERGE BRANCH WITH MUSTER

:git checkout master

GIT for starters

https://www.youtube.com/watch?v=HVsySz-h9r4

GitHub https://www.youtube.com/watch?v=SwK2dPFXhpU

https://www.youtube.com/watch?v=SwK2dPFXhpU

https://www.youtube.com/watch?v=SwK2dPFXhpU

Permissions http://www.thinkplexx.com/learn/howto/security/ssh/fix-permissions-are-too-open-private-key-will-be-ignored

http://ryanstutorials.net/linuxtutorial/permissions.php

NEW REPO CAN’T PUSH

git pull https://github.com/thomas07vt/MyFirstRepo.git master http://www.betterwaytoweb.com/how-to-use-github-a-

tutorial-for-beginners/

Check current installed version version

Start from NONE EXISTENCE PREPO

To remove run:

:git rm –rf .git

IN Proj dir:

:ld –la look for ? .git

If not there

DO

Run this git <init> command in project

dir

EFFECT: create .git dir containing all

project files

View files in the local repo

Not yet committed to the remote repo

Hide files

:touch .gitignore

:vim .gitignore

Add all names of the files to be hidden

from public e.x: *.o etc

Add all to staging area

REMOVE FILES

Reset will remove all

Reset file name will remove a single file

https://youtu.be/HVsySz-h9r4?t=936

Start from EXISTING REPO

[email protected]:Inguane/CS-471.git

:git branch –a

List all existing branchs

code AFTER EDDITING

branch WORKING FROM BRANCH

:git branch

List all existing branches

Checkout a branch to start working on

NOTE: * => active branch

ACTIVE BRAMCH IS IN GREEN

ALL committs are done as prev

Git

PUSHGIT

FORCE PULL

https://www.youtube.com/watch?v=HVsySz-h9r4&index=1&list=PL-osiE80TeTuRUfjRe54Eea17-YfnOOAx

https://www.youtube.com/watch?v=HVsySz-h9r4

https://www.youtube.com/watch?v=iCGrKFH2oeo

1 IN Project dir

:git init Initialize an empty repo

:git touch README.md Create README markdown file

:git vim README.md Edit

:git status View repo current status

:git add README.md

:git add -A

Add all files

:git status

:git commit –m ‘what and why’

Remove just Added files

:git reset filename

:git reset Remove all added files

:git log Verify the commit

:git remote add origin ssh-repo-full-path

DONE ONCE PER REPO

:git remote -v Double check if ready for push

:git pull origin master

:git push –u origin master

:git

:git Dependency

:git pull https://github.com/thomas07vt/MyFirstRepo.git

master

Create files that will not be traced

:touch .gitignore Add all file names to be ignored by git

:vim .gitignore

CLONE PROJ

:git clone <from git url> <to local dir> . => current dir

:git diff See changes made

BRACH

S

[copy of original code or project]

:git branch <branch name> Create a branch

:git branch List all existing branmchs

:git checkout <branch name to work on > Make branch active

PUSH BRANCH to MASTER REPO

:git push –u origin branch name Push to master repo

:git branch -a Display all our branchs

MERGE BRANCH TO A MASTER

:git checkout master Switch to mater branch

:git pull origin master

Always pull the master before each

push

:git branch --merged List of Merged branchs

:git merge branch name

:git push origin master

DELETE NO LONGER NEEDED BRAC H

:git branch --merged

:git branch –d branch name

:git branch -a

:git push origin –-delete branch name Delete from remode

REMOVE REPO

:git rm –rf .git

ADD ALL CHANGES MADE

:git add -A Add all changes

NEXT commit –m “---“

MERGE BRANCH WITH MUSTER

:git checkout master

GIT for starters

https://www.youtube.com/watch?v=HVsySz-h9r4

GitHub https://www.youtube.com/watch?v=SwK2dPFXhpU

https://www.youtube.com/watch?v=SwK2dPFXhpU

https://www.youtube.com/watch?v=SwK2dPFXhpU

Permissions http://www.thinkplexx.com/learn/howto/security/ssh/fix-permissions-are-too-open-private-key-will-be-ignored

http://ryanstutorials.net/linuxtutorial/permissions.php

NEW REPO CAN’T PUSH

git pull https://github.com/thomas07vt/MyFirstRepo.git master http://www.betterwaytoweb.com/how-to-use-github-a-

tutorial-for-beginners/

Installing

Git

OR

Initialize Git

Add link to

remote

******************

>git remote add origin [url]

>git push -u origin master

*Here after use

*git pull

*git push

Configuratio

n

First time

remote push

$ git push -u origin [ branch-name ]

*Here after use

*git pull

*git push

Setup Editor

Settings

Help

Remove,

untrack,

delete the

repo

Clone [optional] repo-new-name

Write to a

file readme

Stage file

Un-stage file

Discard

changes Get

previous

file

Force push git merge --allow-unrelated-histories FETCH_HEAD

git difftool

tree

Continue 49

Eclipse https://www.youtube.com/watch?v=r5C6yXNaSGo

Add & commit

combo

Remove file

Rename file

List all

commits

$ git log

verbose commit list

Check current installed version version

Start from NONE EXISTENCE PREPO

IN Proj dir:

To remove run:

:ld –la look for ? .git

If not there

DO

Run this git <init> command in project

dir

:git rm –rf .git EFFECT: create .git dir containing all

project files

View files in the local repo

Not yet committed to the remote repo

Hide files

:touch .gitignore

:vim .gitignore

Add all names of the files to be hidden

from public e.x: *.o etc

Add all to staging area

REMOVE FILES

(use "git checkout -- <file>..." to discard changes in working directory

Reset will remove all

Reset file name will remove a single file

reset

https://youtu.be/HVsySz-h9r4?t=936

Start from EXISTING REPO

[email protected]:Inguane/CS-471.git

:git branch –a

List all existing branches

code AFTER EDDITING

branch WORKING FROM BRANCH

CREATE BRANCH

:git branch

List all existing branches

Checkout a branch to start working on

NOTE: * => active branch

ACTIVE BRAMCH IS IN GREEN

ALL commits are done as prev

Check current installed version version

Start from NONE EXISTENCE PREPO

IN Proj dir:

:ld –la look for ? .git

If not there

DO

Run this git <init> command in project dir

EFFECT: create .git dir containing all project files

To remove run:

:git rm –rf .git

View files in the local repo

Not yet committed to the remote repo

Hide files

:touch .gitignore

:vim .gitignore

Add all names of the files to be hidden from

public e.x: *.o etc

Add all to staging area

REMOVE FILES

Reset will remove all

Reset file name will remove a single file

https://youtu.be/HVsySz-h9r4?t=936

Start from EXISTING REPO

[email protected]:Inguane/CS-471.git

:git branch –a

List all existing branchs

code AFTER EDDITING

branch WORKING FROM BRANCH

:git branch

List all existing branches

Checkout a branch to start working on

NOTE: * => active branch

ACTIVE BRAMCH IS IN GREEN

ALL committs are done as prev

Installing Git

OR

Initialize Git

Add link to

remote

******************

>git remote add origin [url]

>git push -u origin master

*Here after use

*git pull

*git push

Configuratio

n

First time

remote push

$ git push -u origin [ branch-name ]

*Here after use

*git pull

*git push

Setup Editor

Settings

Help

Remove,

untrack,

delete the

repo

Clone [optional] repo-new-name

Write to a

file readme

Stage file

Un-stage file

Discard

changes Get

previous

file

Force push git merge --allow-unrelated-histories FETCH_HEAD

git difftool

tree

Continue 49

Eclipse https://www.youtube.com/watch?v=r5C6yXNaSGo

Add & commit

combo

Remove file

Rename file

List all

commits

$ git log

verbose commit list

Command line instructions

Git global setup

[ L2: ]

git config --global user.name "Wave" git config --

global user.email "[email protected]" Create a

new repository

git clone [email protected]:Inguane/writing-center-machine.git

[ L3: ]

cd writing-center-machine

touch README.md git add

README.md git commit -m

"add README" git push -u

origin master

refresh the browser

[ exit ]

Existing folder or Git repository cd

existing_folder

git init [ L1: ] git remote add origin [email protected]:Inguane/writing-

center-machine.git [ goto L2 ]

git add . git commit git

push -u origin master

Command line instructions

Git global setup

[ L2: ]

git config --global user.name "Wave" git config --

global user.email "[email protected]"

Create a new repository

git clone [email protected]:Inguane/writing-center-machine.git

[ L3: ]

cd writing-center-machine

touch README.md git

add README.md

git commit -m "add README" git push -u origin master refresh the browser

[ exit ]

Existing folder or Git repository

cd existing_folder git init [ L1: ] git remote add origin

[email protected]:Inguane/writing-center-machine.git

[ goto L2 ] git add . git

commit git push -u

origin master

SETUP