Git – Remove commit from history

If it’s only on your local PC (or noone checked out your changes): Use: git log to find the commit you want to remove. Copy hash (the long sqeuence like: e8348ebe553102018c…). Use: git rebase -i [hash]~ : for example git rebase -i e8348~ Just remove the commit you don’t need and save the file. Interactive … Read more

Found a swap file by the name

Looks like you have an open git commit or git merge going on, and an editor is still open editing the commit message. Two choices: Find the session and finish it (preferable). Delete the .swp file (if you’re sure the other git session has gone away). Clarification from comments: The session is the editing session. You can see what .swp is being used by entering … Read more

Push local Git repo to new remote including all branches and tags

To push all your branches, use either (replace REMOTE with the name of the remote, for example “origin”): To push all your tags: Finally, I think you can do this all in one command with: However, in addition –mirror, will also push your remotes, so this might not be exactly what you want.

git push –force-with-lease vs. –force

force overwrites a remote branch with your local branch. –force-with-lease is a safer option that will not overwrite any work on the remote branch if more commits were added to the remote branch (by another team-member or coworker or what have you). It ensures you do not overwrite someone elses work by force pushing. I think your … Read more

Pretty Git branch graphs

2108 Update 2: I’ve posted an improved version of this answer to the Visualizing branch topology in Git question, since it’s far more appropriate there. That version includes lg3, which shows both the author and committer info, so you really should check it out. Leaving this answer for historical (& rep, I’ll admit) reasons, though I’m really tempted … Read more

Git stash pop- needs merge, unable to refresh index

First, check git status.As the OP mentions, The actual issue was an unresolved merge conflict from the merge, NOT that the stash would cause a merge conflict. That is where git status would mention that file as being “both modified“ Resolution: Commit the conflicted file. Solution: in this case, simply add and commit your local file. You can … Read more

git undo all uncommitted or unsaved changes

This will unstage all files you might have staged with git add:git reset This will revert all local uncommitted changes (should be executed in repo root):git checkout . You can also revert uncommitted changes only to particular file or directory:git checkout [some_dir|file.txt] Yet another way to revert all uncommitted changes (longer to type, but works from … Read more

Can I arrange repositories into folders on Github?

Update Dec. 2021: Lists are now available as a public beta Lists level up the starring experience by making it easy to organize and curate your favorite repositories on GitHub. You can create public lists that appear on your stars page at https://github.com/USERNAME?tab=stars. Lists are available to everyone except enterprise managed users. Original answer: On GitHub … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)