> Interstellar Git Hacker-rank Hands-On Solutions - TECH UPDATE

Interstellar Git Hacker-rank Hands-On Solutions

 Interstellar Git Hands-On Solutions


The Course Id of Interstellar Git is 61738.

1. Try it out: Cherry-Pick



cd test/

ls

cat greetings.sh

git checkout username

git log --pretty=oneline

git checkout master

git cherry-pick e0b8133a455874c673c3c41e3387b12b9560dd32


2. GIT STASH



cd file/

vi calc.py


Press i for INSERT then type below code


sum = float(num1) + float(num2)

+diff = float(num1)-float(num2)

=mul = float(num1) * float(num2)

+div = float(num1) / float(num2)


Esc -> :wq -> Enter


git stash (saved working directory)

vi calc.py


num1 = input('Enter first number: ')

num2 = input('Enter second numbr: ')


git add .

git commit -m 'STEP 4' (1 file changed)

git push origin master

git tag -a v1.0 -m "first"

git stash list

vi calc.py


[Press i]

print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))

+print('The difference of {0} and {1} is {2}'.format(num1, num2, diff))

+print('The product of {0} and {1} is {2}'.format(num1, num2, mul))

+print('The division of {0} and {1} is {2}'.format(num1, num2, div))


[Press ESC and type :wq]

git add .

git commit -m "step 7"

git tag -a v2.0 -m "second"

git push origin master


3. GIT BLAME



cd local/

ls

cat newfile.py

vi newfile.py


print('Hello World!!!')

This is the second line!

This is the third line!

a = 10+20

print(a)


git add .

git commit -m 'added two lines as step 2"

git push origin master

git blame newfile.py


touch output.txt

vi output.txt


This is the second line! (press i and type the line later ESC + :wq]


4. GIT Submodule 



cd file/

mkdir vendor

cd vendor/

git submodule add /projects/challenge/.assessment/2

git status

git add .

git commit -m "on step2"

git push origin master

cd 2

vi dependency1.py


[press i and give space then ESC + :wq]


git add .

git commit -m "new line added"

git submodule status

cd ..

git status

git log --oneline

git add .

git commit -m "complete step3"

git push origin master


5. GIT REFLOG



cd file/

ls

touch file4.py

vi file4.py [:wq and press enter]

git add .

git commit -m "New file added"

git push origin master

git reflog

git reset --hard Head~1

git reflog


git cherry-pick a297431 (commit id of New file added)

git reset --hard


6. GIT HOOKS



cd test/

cd .git/hooks/

touch post-commit

vi post-commit


git push origin master [ESC + :wq enter]


chmod +x post-commit

cd ..

cd ..

touch new_file.txt

git add .

git commit -a -m "commitMessage"


7. GIT BISECT 



cd local/

ls

cat newfile.py

git log --oneline

git bisect start

git bisect good 72c7e9d (perform addition)

git bisect bad

cat newfile.py

git bisect bad

cat newfile.py

git bisect good (when you see b = 20)

git bisect reset

git revert 317f20..... (commit id above you will see) [Ignore Errors]

git commit -u newfile.py ( Nothing just type :wq and Enter]

git add .

git commit -m "revert"

git push origin master

Interstellar Git Hacker-rank Hands-On Solutions Interstellar Git Hacker-rank Hands-On Solutions Reviewed by TECH UPDATE on February 05, 2022 Rating: 5

39 comments:

  1. Hi,

    GIT BISECT hands on is not fully working, 4/6 test cases only passing, please check the code,thanks

    ReplyDelete
    Replies
    1. GIt submodules are not working

      Delete
    2. Yes bro..Git Submodule Are not Working..Please any one Provide Solution....

      Delete
    3. Yes Submodule and Git Blame hands on is not Working.. could You Check the Code...Thanks...

      Delete
    4. is working you need change the part of message of commit. Also this is the secondline you need to put on output.txt

      Delete
  2. 7. GIT BISECT




    cd local/

    ls

    cat newfile.py

    git log --oneline

    git bisect start

    git bisect good 72c7e9d (perform addition)

    git bisect bad

    cat newfile.py

    git bisect bad

    cat newfile.py

    git bisect good (when you see b = 20)

    git bisect reset

    git revert 317f20..... (commit id above you will see) [Ignore Errors]

    git revert is not working please help

    ReplyDelete
  3. 7. GIT BISECT




    cd local/

    ls

    cat newfile.py

    git log --oneline

    git bisect start

    git bisect good 72c7e9d (perform addition)

    git bisect bad

    cat newfile.py

    git bisect bad

    cat newfile.py

    git bisect good (when you see b = 20)

    git bisect reset

    git revert 317f20..... (commit id above you will see) [Ignore Errors]

    Please help

    Git revert not working.

    ReplyDelete
  4. Hello bro
    Asalu ela cheyaloo ardam avatam ledu bro,pls help cheyandi bro only handson pending

    ReplyDelete
    Replies
    1. Me to same, pending hands on but bisect and submodule

      Delete
    2. In git submodule , CD 2, is not available in the directory, how to change it, and while create new one how to work on it please help me

      Delete
  5. cd local/

    ls

    cat newfile.py

    git log --oneline

    git bisect start

    git bisect good 72c7e9d (perform addition)

    git bisect bad

    cat newfile.py

    git bisect bad

    cat newfile.py

    git bisect good (when you see b = 20)

    git bisect reset

    git revert 317f20..... (commit id above you will see) [Ignore Errors]

    Here 317f20.... hash is the sha of bad commit which you will get when you run the above command bisect good or reset.

    git commit -u newfile.py ( Nothing just type :wq and Enter]

    git add .

    git commit -m "revert"

    got pull origin

    git push origin master

    ReplyDelete
    Replies
    1. git revert --continue

      Delete
    2. I'm not able to complete this test it's showing like error is git revert fail plz healp me

      Delete
    3. Bro git bisect

      Revert checks failed

      Tried lot of times but failed

      Delete
    4. Add these two below lines after : git commit -m "revert"
      git pull --rebase
      git push

      Delete
    5. This is the correct solution all test get passed

      Delete
    6. Revert Check... Fail

      is failing under 7. GIT BISECT. Is it possible to correct code here .. ?

      Delete
  6. bisect revert test case failing. help please......

    ReplyDelete
  7. For command git cherry-pick e0... The terminal output is fatal: bad object e0... What should we do in that case

    ReplyDelete
  8. Git bisect revert is failing.. Not sure which hash to be taken.. could you please add screenshot and highlight it

    ReplyDelete
  9. None of the course hands on working ..all got failed ..plz provide interstellar git hands on

    ReplyDelete
  10. I think these below commands are required for cherry-pick
    git add .
    git cherry-pick --continue

    ReplyDelete
    Replies
    1. Many thanks, adding these commands helped me in clearing cherry pick hands on

      Delete
  11. Git bisect and cheerypick is not working .plz somebody help me

    ReplyDelete
    Replies
    1. After - git commit -u newfile.py - follow the below steps

      git revert 317f20.....
      git add .
      git commit Revert "Perfom Calucultion"
      git push origin master

      test pass.................

      Delete
  12. Please update the git bisect

    ReplyDelete
  13. Pls help me for git submodule code, it's not able to execute

    ReplyDelete
  14. Bro, please. Help me for GIT SUBMODLE CODEA, IT'S NOT executive 2 test cases, please help. Me , this
    code

    ReplyDelete
  15. The sobmodule is not working it says clonr failed

    ReplyDelete
  16. git submodule is not working for me...
    priminary local directory checks in local repository.. under this commit check is fail.... please help

    ReplyDelete
  17. git reflog ... In reset command, Head shud be all Caps ...
    git reset --hard HEAD~1

    ReplyDelete
  18. Can you please post the correct code for Cherry-Pick ? The above doesnot seem to work.

    ReplyDelete
  19. Cherry-Pick is not working, please help!

    ReplyDelete
  20. 1. Try it out: Cherry-Pick is not working

    ReplyDelete
  21. 1. Try it out: Cherry-Pick is not workingggg

    ReplyDelete
  22. git blame is not working "output file check is fail" plz help me

    ReplyDelete

Powered by Blogger.