{"id":20499194,"url":"https://github.com/mohdnehalkhan/git-cheatsheet","last_synced_at":"2025-07-18T01:06:38.072Z","repository":{"id":242117610,"uuid":"808729307","full_name":"MOHDNEHALKHAN/Git-Cheatsheet","owner":"MOHDNEHALKHAN","description":"Repository contains all commands of git in our day to day work","archived":false,"fork":false,"pushed_at":"2024-06-05T03:10:26.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-16T06:58:02.042Z","etag":null,"topics":["development","git","vcs","version-control"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MOHDNEHALKHAN.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-31T17:31:31.000Z","updated_at":"2024-06-05T03:10:29.000Z","dependencies_parsed_at":"2024-06-05T04:27:38.694Z","dependency_job_id":"25acb523-d170-4557-8085-20fef1cc2e6c","html_url":"https://github.com/MOHDNEHALKHAN/Git-Cheatsheet","commit_stats":null,"previous_names":["mohdnehalkhan/git-cheatsheet"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MOHDNEHALKHAN%2FGit-Cheatsheet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MOHDNEHALKHAN%2FGit-Cheatsheet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MOHDNEHALKHAN%2FGit-Cheatsheet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MOHDNEHALKHAN%2FGit-Cheatsheet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MOHDNEHALKHAN","download_url":"https://codeload.github.com/MOHDNEHALKHAN/Git-Cheatsheet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242089144,"owners_count":20069919,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["development","git","vcs","version-control"],"created_at":"2024-11-15T18:16:46.396Z","updated_at":"2025-03-05T19:23:30.166Z","avatar_url":"https://github.com/MOHDNEHALKHAN.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# GIT CHEATSHEET\n\n| COMMAND | EXPLANATION (USES) |\n| --- | --- |\n| `git config` | Set configuration Variables |\n| `git config --global user.name \"Your name\"` | Set your name |\n| `git config --global user.email \"Your email\"` | Set your email address |\n| `git config --global core.editor \"Your IDE\"` | Set your default text editor |\n| `git config --list` | To list all the settings |\n| `git help config` | To get help while using git |\n| `git init` | To track project in git |\n| `git add` | To track a new file in a project |\n| `git commit or git commit -m 'Commit message'` | To commit after staging a file |\n| `git commit -a -m 'Your message'` | Helps to commit while skipping staging a file(Directly add \u0026 Commit)  |\n| `git commit -amend` | It overwrites your previous commit |\n| `git clone url` | To get a copy of repository |\n| `git clone /../../ or git clone file://` | To clone a local repository |\n| `git status` | To check which files are in which state |\n| `git status -s or git status -short` | Give simplified output from this command |\n| `.gitignore` | Files that you don't want Git to automatically add or even show you as being untracked |\n| `git diff` | To see the changes in your files |\n| `git diff --staged` | To see what you have staged and want to commit |\n| `git diff --cached` | It shows all the difference between staged files |\n| `git rm`  | To remove a file from git |\n| `git rm --cached`| To keep file in working tree but remove it from your staging area |\n| `git mv file_from file_to` | Helps to rename a file |\n| `git log or git log -p -2` | To see the history of commits |\n| `git log --stat` | To see some abbreviated stats for each commit |\n| `git log --pretty=online` | Helps to prints each commit on a single line |\n| `git log --pretty=format:\"%h - %an ,%ar :%s\"` | It allow you to specify your own log output format |\n| `git log --pretty=format:\"%h %s\" --graph` | It adds a nice little ASCII graph showing branch \u0026 merge history |\n| `git log --since` | This helps us to check the history of weeks , months |\n| `git log --Sfunction_name` | Shows a commits that introduced a change to the code that added or remove that string |\n| `git log --online --decorate --graph --all` |  |\n| `git reset HEAD \u003cfile\u003e` | Helps to unstage the commit |\n| `git checkout -- \u003cfile\u003e` | Helps to discard or revert the changes  |\n| `git remote add origin \u003cremote repository URL\u003e` | Helps to add a remote repo to local repo |\n| `git remote add \u003cshortname\u003e \u003curl\u003e` | To add a new remote repository as a shortname |\n| `git remote -v` | It shows the URLs that git has stored for the shortname to be used when reading \u0026 writing |\n| `git fetch [remote-name]` | To get data from your remote repo |\n| `git pull [remote-name]` | To get data from your remote repo |\n| `git push -u origin main` | Upstream the remote branch for local branch |\n| `git push [remote-name][branch-name]` | This works only if cloned from a server to which you have write access \u0026 if nobody has pushed in the meantime  |\n| `git remote show [remote-name]`  | To see more information about a particular remote |\n| `git remote rename file_from file_to` | To change the remote’s shortname  |\n| `git remote rm \u003cfile\u003e` | To remove a remote file  |\n| `git tag` | It helps us to tag specific points in history |\n| `git show` | To see the data along with the commit that was tagged  |\n| `git push origin [tagname]` | Helps to  transfer tags to remote server |\n| `git push origin --tags` | To push all tags to remote server at once |\n| `git config --global alias.co checkout or git config --global alias.br branch or  git config --global alias.ci commit` | It helps us to set up git commands for easily use  |\n| `git branch \u003cbranch name\u003e` | It creates a new branch |\n| `git branch -m master main` | It change the branch name |\n| `git checkout \u003cbranch name\u003e` | Helps to switch to an existing branch |\n| `git merge \u003cbranch name\u003e`  | It helps to merge the branch to the master(main) branch |\n| `git branch -d \u003cbranch name\u003e`  | Helps to delete the branch when no longer needed |\n| `git branch -D \u003cbranch name\u003e` | It helps us to force delete the branch when not done with -d |\n| `git mergetool`  | Helps to use the graphical tool to resolve the issue |\n| `git branch -v` | Shows  a simple listing of your current branches |\n| `git branch --merged` | To see which branches are merged into the branch you’re currently on |\n| `git branch --no-merged` | TO see all the branches that contain work that haven’t yet merged |\n| `git fetch (remote)(branch)` | It helps to fetch the data from the remote to your local branch |\n| `git push (remote)(branch)` | It helps to push code to remote branch or on server |\n| `git checkout -b [branch][remotename]/[branch]`  | To get your own branch from remote branch to your local branch |\n| `git branch -vv`  | This lists your local branches with more info., including the branch is tracking or your local branch is a head, behind or both |\n| `git push [remote] --delete [branchname]`  | It is use to delete a remote branch  |\n| `git rebase \u003cbranch name\u003e` | It takes all the changes that were committed on one branch \u0026 replay them on another one |\n| `git rebase --onto\u003cbranch 1\u003e\u003cbranch 2\u003e\u003cbranch 3\u003e` | Checkout the branch 1 , figure out the patches from the common ancestor of the branch 2 \u0026 3 and replay them on branch 1 |\n| `git rebase [basebranch][topicbranch]` | Rebase the topic branch on top of the base branch without having to check it |\n| `git push --force` | It is use to overwrite the history on the server when we are using command rebase and collaborating with others |\n| `git pull --rebase` | It is used to fetch and merge changes from a remote repository while also rebasing any local commits on top of the updated remote branch. |\n| `git config --global pull.rebase true` | When you are using git pull  \u0026 want to make a default  rebase |\n| `git remote add local_/../../..git`  | To add a local repo to an existing git project |\n| `git clone --bare`  | It is used to create a bare repository, which is a special type of Git repository that does not contain a working directory. |\n| `git daemon` | It is used to start a lightweight Git server that allows clients to fetch and push changes to a Git repository over the network. |\n\nDownload the Pdf for cheatsheet\n[Click Here👇](https://nehalkhan.gumroad.com/l/fnuxx?layout=profile)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmohdnehalkhan%2Fgit-cheatsheet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmohdnehalkhan%2Fgit-cheatsheet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmohdnehalkhan%2Fgit-cheatsheet/lists"}