LinearArray@programming.dev to Programmer Humor@programming.devEnglish · 1 年前Hey, I'm new to GitHub!programming.devimagemessage-square310fedilinkarrow-up11.28Karrow-down121
arrow-up11.26Karrow-down1imageHey, I'm new to GitHub!programming.devLinearArray@programming.dev to Programmer Humor@programming.devEnglish · 1 年前message-square310fedilink
minus-squareEkky@sopuli.xyzlinkfedilinkEnglisharrow-up2arrow-down1·edit-21 年前like this? # Let Git take a rest with some yummy awk chocolate logs with delicious nuts and seeds, and don't be pushy! git reset --hard $(git log --reverse | sed -n 1p | awk -F "[ ]" '{print $2}') && git push -f EDIT: Don’t actually run it.
minus-squaresubtext@lemmy.worldlinkfedilinkarrow-up2·1 年前Can you explain what this does? I’m thinking something along the lines of reverting all commits except the very first one?
minus-squareEkky@sopuli.xyzlinkfedilinkarrow-up3·1 年前You are correct! It sets HEAD to the first commit and then force pushes, deleting everything after HEAD. Though, it only affects the currently selected branch.
like this?
# Let Git take a rest with some yummy awk chocolate logs with delicious nuts and seeds, and don't be pushy! git reset --hard $(git log --reverse | sed -n 1p | awk -F "[ ]" '{print $2}') && git push -f
EDIT: Don’t actually run it.
Can you explain what this does? I’m thinking something along the lines of reverting all commits except the very first one?
You are correct! It sets HEAD to the first commit and then force pushes, deleting everything after HEAD.
Though, it only affects the currently selected branch.