Facing difficulty in "Git Hooks" and "Git Rebase"

Hi All,
Recently, I am performing tasks of “Level 4 GIT” earlier i had done with all the previous 3 levels and 3 tasks of level 4 also.
So, now i am lef with only 2 tasks named “Git Hooks” and “Git Rebase”… I had tried to complete them several times repeatedly but can’t be able to accomplish the tasks… So i request you all to help me out in these 2 tasks also.
Thank you in advance :blush:

Infact i am strucked at the same position and can’t be able figure out what i am doing wrong here

Click the link I provided in my post.

Alright i will try again and will get back to you

I am also facing issue with Git Rebase do you have any idea about this one too

I am not a Pro user, I have no access to Git Rebase Task yet. So I do not know what is the Task Description… Not sure if KKE staff would like if we share Task Description here in public… that is why I am not and should not be asking you for the Task Description…

For reset and this post-update tasks, someone (you on reset) already posted the information (not full Task Description) and I simply create environment base on info provided… and test… and share results…

Okay thanks for the help😊

Nope… the task for git hooks is still not completed

@Yash-Varma

  • For task about git hooks, you need to update the hooks script on bare-repo folder
  • For task about rebase be sure to push change after done the rebase

The links below can help you better understand the concept convert on the tasks

https://git-scm.com/docs/git-rebase

Regards

1 Like

Thank you for the help :blush:

From the link I posted,

https://git-scm.com/docs/githooks#post-update

First paragraph, 2nd sentence,

It executes on the remote repository once after all the refs have been updated.

Hi @yash-varma

What issue in specific do you have with the Git Rebase lab ? I had already done it, some maybe I can help you if you tell me more about the specific issue. Also I had read the @sauron post recently now. This days I had been a little more bussy than usual, so I didn’t have time until now to enter to kodekloud. Later I will come here to try the sauron help from my post, so maybe I can help you yash.

Regards!

1. cd /usr/src/kodekloudrepos

2. cd apps

3. git rebase master
O/P: Successfully rebased and updated refs/heads/master. (branch feature)

4. git checkout master

5.git rebase feature
0/P: Successfully rebased and updated refs/heads/master. (branch master)

6. git push
O/P after Push: Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 36 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 296 bytes | 296.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To /opt/apps.git
d0e1550…9885f07 master → master

Error I am getting after checking the task:- required data not found under repo, seems like ‘feature’ branch was not rebased with ‘master’.

I think i am messing up with the commands.Please Check…
@carlos140

Thanks, I will do the lab in a couple of hours and I will let you know here.

Have you still having issues with the git hooks lab? I’m thinking there is an issue with that lab, if your answers is yes, please try to post in my thread here so maybe we can have an answer. Can check if the level 4 lab 3 of git is working right?

Yes I have issues with hooks also

I think when you attempt the Rebase task pls do share the commands and diagnosis of the lab too so that i can see my mistake

Hi

I had been working in the lab this hour but still I don’t know how did I get it to succeed :upside_down_face: . I can try tomorrow, because now I have to do another stuff. But I can tell you somethings:

You also need to not add a commit message in the rebase branch. So when you are going to do git rebase, you need to also make it like this: git rebase -i master feature . With this you should be able to run the interactive mode. There you can use the squash command to join two commits in one commit. So you need to check the sha checksum of your last master commit, and squash the feature commit. Then read the terminal info that is displayed. After that you should be able to do git rebase --continue, here you can change the commits comments and delete it.

I was able to do that, but i get the features commit in the top of my git tree, instead of the master :upside_down_face: . I will try this tomorrow, but try to play with the git rebase -i options if you can.

Also maybe you don’t need to make your third step (git rebase master), If I’m remembering well, I didn’t do that, but try to check with that also.

Tell me how are you doing with this info, maybe tomorrow we can figure out (In my case again :melting_face:)

Hi @Yash-Varma

No need to rebase the master only the feature is asked to rebase

The push should be done on the feature branch not the master

Good luck

Hi @Yash-Varma Thanks to the info by @mmkmou I had done it once again!

Go and try it by yourself first, but if you think you need to see the answer here is down below:

Assuming your are in the repo folder under the feature branch:

sudo git rebase master feature
sudo git push origin feature \\Check the warnings from terminal (To understand what's is going on)
sudo git pull origin feature \\Once again the same as the last comment
sudo git config pull.rebase true
sudo git pull origin feature
sudo git push origin feature 

Thats it. Use git check log to see how the branch is changing after each step.
Best Regards!

3 Likes