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 user.email "vladan.colovic@fairwalter.ch"
git config --global user.name "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
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: https://stackoverflow.com/a/21302915/586898
More: https://www.reddit.com/r/git/comments/4da6jq/gitattributes_textauto_eol/ https://stackoverflow.com/questions/21472971/what-is-the-purpose-of-text-auto-in-gitattributes-file
|
|
|
|
|
|
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!
Cloning Private Repository
When I want to clone a private repository without using SSH keys, it is necessary to do so using a Personal Access Token (PAT). It is important to ensure that the PAT is not granted more access privileges than read-only when doing so.
git clone https://cvladan:${GITHUB_TOKEN}@github.com/cvladan/security-assessment.git
git clone https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}
Change past commits in bulk to remove sensitive data from Git repos using rtyley/bfg-repo-cleaner like git-filter-branch