Revert already pushed commit

Revert already pushed commit

Revert already pushed commit How do I use ‘git reset –hard HEAD’ to revert to a previous commit? - Stack Overflow

Move the most recent commit(s) to a new branch with Git - Stack Overflow

git push –all origin This will push tags and branches. version control - Set up git to pull and push all branches - Stack Overflow

Usual: How to revert to a previous commit when you’ve already pushed your changes

On undoing, fixing, or removing commits in git Git Revert | Atlassian Git Tutorial Resetting, Checking Out & Reverting | Atlassian Git Tutorial

Learning to use GIT

Git? Git Tutorial for Beginners: Basic Git Commands – IT Stuff – Medium Git Tutorial for Beginners: Remote Repository Management Commit Often, Perfect Later, Publish Once—Git Best Practices

Windows & Git Line Endings

git config --global ""
git config --global "Vladan Colovic"
git config --global core.autocrlf true

Display Git config and see where that setting is defined (global, user, repo, etc)

git config --list --show-origin

Better aproach

Better way is to set line endings handling in repository using .gitattributes

.gitattributes Documentation

echo "* text=auto !eol" >.gitattributes
git add --renormalize .
git status # Show files that will be normalized
git commit -m "Introduce end-of-line normalization"

* text=auto !eol All files have the attribute text set to auto and the eol attribute unspecified. Reading the documentation we find out that text=auto means that you let git decide if a file is text and if it is it will normalize it (set line-endings in the repo to LF

Easier explanation:


git init
echo "* text=auto !eol" >.gitattributes
git add .
git commit -m "first commit"
git branch -M main
git remote add origin
git status
git push -u origin main
echo "/public" >>.gitignore
echo "/resources" >>.gitignore

# option "-b" defines branch on submodule that will be tracked
git submodule add -b master themes/zdoc
git submodule add -b main content
# this is pull together with submodules, but it's not pulling the latest commit
git pull --recurse-submodules

# will update to latest commit on branch in submodules
git submodule update --remote

It’s a little confusing, but submodules are not on a branch. They are just a pointer to a particular commit of the submodule’s repository. So when someone else checks out your repository or pulls your code, and does git submodule update, submodule is checked out to that particular commit.

The thing that the -b option gives us is the ability to add --remote flag to your update directive: git submodule update --remote

Also, please research setting an option: git config --global submodule.recurse true

Multiple Deploy Keys in repo and submodules on GitHub

Lots of discussion on solution to this problem…

How to configure multiple deploy keys for different private github repositories

Perfect solutions for multiple deploy keys on submodule

Amazing idea is to create a command, eg custom_keys_git_ssh and used it in GIT_SSH_COMMAND variable instead direct ssh. Intercept that and automatically load appropriate keys when loaded.

That idea is implemented here: Multiple ssh deploy keys with git and it is perfect!

date 27. Aug 2019 | modified 28. May 2021
filename: Git » Dump