Relative Content

Git

Reset a single file to a specific commit

Assuming the hash of the commit you want is c5f567: The git checkout man page gives more information. If you want to revert to the commit before c5f567, append ~1 (where 1 is the number of commits you want to go back, it can be anything): As a side note, I’ve always been uncomfortable with this command because it’s used for […]

Git workflow

Here you can see the basics workflow for gitAfter cloning your repo from any git platform provider Like github, gitlab, bitbucket etc… .Firstly check branch:git branch(your base branch, most likely develop or master. Consider develop as a base branch)Fetch latest remote code to local:git pull(for latest develop code)Checkout new branch as per feature andgit checkout […]

Git update and publish

git remote -vgit remote showgit remote addgit fetchgit fetch –allgit pull | git pullgit pushgit pushgit push origin :old-name new-namegit push origin -u new-namegit branch -drgit push origin YourTagVersion

Git undo

git reset –hard HEADgit reset –softgit checkout HEADgit revertgit reset –hardgit reset –hardgit reset –keep

Git merge and rebase

git mergegit rebasegit rebase –continuegit rebase –abortgit mergetoolgit add | git rm

Git local changes

git statusChanges files in your working directorygit diffChanges to tracked filesgit diff <filename|filepath>Show or list our the changes of specific file as per comparison to previous commitgit add . | git add ..Add all current changes to the next commitgit add FILENAMEAdd particular file changes to the next commitgit add -pgit commitgit commit -m ‘Commit […]

Git create a repository

git initCreate a new local repositoryThe git init command creates a new Git repository. It can be used to convert an existing, unversioned project to a Git repository or initialize a new, empty repository. Most other Git commands are not available outside of an initialized repository, so this is usually the first command you’ll run […]

Git config file tips

These commands work on /.git/config filegit config –system–unset credential.helpergit config –global–unset credential.helpergit config –global credential.helper wincredgit config –global credential.helper osxkeychain To update your credentials, go to Control Panel → Credential Manager → Generic Credentials. Find the credentials related to your Git account and edit them to use the updated password. Reference: How to update your Git credentials on Windows Note that […]