You are on page 1of 3

git init

touch index.html
git add -A
git commit -m "Initial commit"

git checkout -b csharp


touch main.cs
edit file
git add -A
git commit -m "csharp HelloWorld"
git checkout master

git checkout -b java


touch main.java
edit file
git add -A
git commit -m "java HelloWorld"
git checkout master

git checkout -b visualbasic


touch main.vb
edit file
git add -A
git commit -m "visualbasic HelloWorld"
git checkout master

git checkout -b brainfuck


touch main.bf
edit file
git add -A
git commit -m "brainfuck HelloWorld"
git checkout master

git checkout -b ada


touch main.adb
edit file
git add -A
git commit -m "ada HelloWorld"
git checkout master

git checkout -b arduino


touch main.ino
edit file
git add -A
git commit -m "arduino HelloWorld"
git checkout master

git checkout -b bash


touch main
edit file
git add -A
git commit -m "bash HelloWorld"
git checkout master

git checkout -b bosque


touch main.bsq
edit file
git add -A
git commit -m "bosque HelloWorld"
git checkout master

git merge csharp


git merge java
git merge javascript
git merge visualbasic
git merge brainfuck

git merge ada


git merge bash
git merge arduino
git merge bash
git merge bosque

git branch -v

git log --pretty=format:"%h : %s"


touch sha-1-heads.txt
edit file
git add -A
git commit -m "Add sha-1-heads.txt file with checksums of all branches"

// Setting your username in Git


git config --global user.name "Jomiru Nicolai"
git config --global user.email "nkujomiru@gmail.com"

// Generate SSH key for PC ..https://docs.github.com/en/github/authenticating-to-


github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
ssh-keygen -t rsa -b 4096 -C "nkujomiru@gmail.com"

git remote add origin https://github.com/nkujomiru/IDWeb.git


git push -u origin master
//PUSH all branches:
git push origin --all

create FINAL.txt

git pull

Pentru nota 10:


• Să se soluționeze un conflict dintre 2 branch-uri

$ touch conflict.txt
$ git co -b conflictingBranch
Switched to a new branch 'conflictingBranch'

$ git co master
$ git add -A
$ git commit -m "Add conflict.txt file"

$ git co conflictingBranch
$ touch conflict.txt

$ git add -A
$ git ci -am"created different conflict.txt file to make conflict"

$ git co master
$ git merge conflictingBranch
CONFLICT (add/add): Merge conflict in conflict.txt
Auto-merging conflict.txt
Automatic merge failed; fix conflicts and then commit the result.

$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)

You have unmerged paths.


(fix conflicts and run "git commit")
(use "git merge --abort" to abort the merge)

Unmerged paths:
(use "git add <file>..." to mark resolution)
both added: conflict.txt

$ cat conflict.txt
<<<<<<< HEAD
Aceast poem e important
si nimeni nu-l poate schimba
Mi-am pus inima in el
si n-am pierdut nici rima
=======
I only have trash to say
>>>>>>> conflictingBranch

$ git add -A

$ git commit -m"Fixed merge conflict and merged conflictBranch"

git push --all

• Să se reseteze un branch la un commit anterior


git reset --soft HEAD~1 (or hash)
git reset --hard

You might also like