xxxxxxxxxx
# How to stash and remove a commit from a branch that has already been pushed
git stash save "<comment>"
git stash pop
# git stash list
git reset --hard HEAD~1
# 1 stands for the amount of commits to go back from HEAD
git push origin HEAD --force
xxxxxxxxxx
# Assuming you want to delete the last local commit
# Make sure you have committed all local changes or stashed them before proceeding
# Use the following command to delete the last local commit
git reset --hard HEAD~1
xxxxxxxxxx
git checkout master
git reset --hard e3f1e37
git push --force origin master
# Then to prove it (it won't print any diff)
git diff master..origin/master
xxxxxxxxxx
# Step 1: Find the commit hash of the commit you want to delete
git log
# Step 2: Revert the target commit and create a new commit
git revert <commit_hash>
# Step 3: Delete the original commit (optional)
git branch temp # Create a temporary branch to keep original commit
git rebase -i <commit_hash>~1 # Starts interactive rebase
# In the interactive editor that appears, delete the line for the original commit
# Save and exit the editor
# Note: Be cautious when modifying the commit history
# Step 4: Push the changes to remote repository
git push origin <branch_name> --force-with-lease
xxxxxxxxxx
# Step 1: Identify the commit you want to remove
git log
# Step 2: Start an interactive rebase and mark the commit to be removed
git rebase -i HEAD~n
# Replace 'n' with the number of commits from the present branch head to the commit you want to remove.
# Step 3: In the interactive editor, delete the line corresponding to the commit you want to remove.
# Step 4: Save and exit the editor.
# Step 5: Force push the updated branch to the remote repository
git push origin <branch-name> --force
xxxxxxxxxx
# First, make sure you are on the branch where the commit is located
git checkout your_branch_name
# Then, start an interactive rebase to modify the commit history
git rebase -i HEAD~2
# An editor will open with a list of the last two commits.
# Change "pick" to "drop" for the commit you want to delete.
# Save and close the editor.
# Git will now remove the unwanted commit(s) from the branch.
# If there are no conflicts, the process will complete automatically.
# Finally, if you have already pushed the branch to a remote repository,
# you may need to force push the modified branch to update it.
git push --force origin your_branch_name
xxxxxxxxxx
//when you being as admin but you cant see ressource of shield in the menu
// and when you try to access it by url shield/roles and it says 403 forbidden
// know that the package work fine but shield odnt recongnize you as superadmin
// this is good solution to fix that
Assign the Role to Your User
Add the super_admin role to your user in the model_has_roles table.
Find your user ID from the users table.
Assign the role using an SQL query:
sql
Copier le code
INSERT INTO model_has_roles (role_id, model_type, model_id)
VALUES (
(SELECT id FROM roles WHERE name = 'super_admin'),
'App\\Models\\User',
YOUR_USER_ID
);
Replace YOUR_USER_ID with your actual user ID