This is a #Hacktoberfest training git repo on GitHub. It contains resources for learning Git. 99% of the contributions in this repository are from different first time beginners just like you. So, jump right in! π―
Meetup Event sponsorship DigitalOcean β
Hacktoberfest is a month-long celebration of open source software run by DigitalOcean in partnership with GitHub and Twilio.
- Hacktoberfest is open to everyone in our global community!
- Five quality pull requests must be submitted to public GitHub repositories.
- You can sign up anytime between October 1 and October 31.
Listing a few git resources here for everyone.
- An interactive basic tutorial to Git: try.github.io
- A very light, but not gentle π, guide to Git: git - the simple guide
- Novice π€ to Ninja β, a complete guide on becoming a Git Guru
- Vogella Git Tutorial
- The (Written) Unwritten Guide to Pull Requests by Blake Riosa
There are tons of learning material on the Web
- Try Git β learn Git in 15 minutes with pseudo-terminal interface
- How to Create a Pull Request β learn to create a GitHub Pull Request
- GitHub Learning Paths β learn about Git, Setup, GitHub, and a lot more
- Atlassian Git Tutorial β comprehensive tutorial on Git
- Use gitk to understand git β all important Git terms (commit, commit SHA, branch, merge, rebase) explained using gitk
- Learn Version Control with Git β freemium ebook from fournova Software (makers for Tower), associated with paid video course
- Learn Enough Git to Be Dangerous - a tutorial on version control with git
- Pro Git β free Git book (CC BY-NC-SA 3.0)
- The Git Community Book β book built by dozens of people in the Git community
- Git Pocket Guide β a short O'Reilly book on Git
- Git Real: Code School β paid training course from Code School
- Git Branching β visual way to learn git branching
- Learn Git in a Month of Lunches β tutorial-based book by Manning Publications
- Git Magic β short book about Git
- Git from the bottom up β great series of articles about Git
- Git-it β app-tutorial on Git
- Learn Git - Codecademy β This course will show you basic workflow and core features, different ways to undo changes or save multiple versions of a project, and how to collaborate with other developers
- Migrating to Git LFS β Use Git LFS on an existing repository to manage large files in a better way
- Learn Git Branching β Interactive way to learn how git branching works
- An Introduction to Git and GitHub by Brian Yu - CS 50 Git Tutorial
- Version Control with Git β The essentials of using the version control system Git
- GitHub & Collaboration β The essentials of working with remote repositories
- How to Use Git and GitHub β Effective use of version control
- Beginner Tutorial: How to user Git for WordPress development by NICK SCHΓFERHOFF
- WordPress + Git = β₯ - Presenting VersionPress
- A full tutorial on Managing WordPress website with Git, consisting 4 articles by Delicious Brains
- Top 8 Resources: WordPress with Git by PANTHEON
- Keeping WordPress Under "Version" Control with Git by Steve Grunwell
- Introductory guide to Git for WordPress with resources and tools
- 8 Ways to Sync Git Repositories with WordPress
Various tools for daily operations
- GitHub Desktop β Git Client by GitHub. works with GitHub and GitHub Enterprise seamless
- SourceTree β free (in-beer) GUI client. Windows and Mac only
- GitKraken β a cross Git client for Windows, Mac & Linux. Electron based. Free for non-commercial use and paid Pro version is available.
- Tower β a popular non-free Git GUI client. Mac and Windows
- SmartGit β a commercial comprehensive SCM client with Git, SVN, Mercurial. cross-platform (works on Windows, Mac and Linux)
- RabbitVCS β TortoiseSVN inspired graphic tool for version control systems, with Nautilus and Thunar integration
- gitg β a open-source GTK+ GUI client
- git-cola β a cross-platform Git GUI client
- SGit β Git client for Android 4.x
- Ungit β The easiest way to use git. On any platform. Anywhere.
- MyRepos β a tool to manage multiple version control repositories
- awesome-git-addons β lists more than 20 git addons including all available commands
- GitIgnore Collection β collection of gitignore files for various programming language
- git-extras β git utilities adding useful git commands
- git-extra-commands β Another collection of useful git commands
- GitUp β a clean, minimal Git client. Mac only.
- GitExtensions β a shell extension, a Visual Studio 2010-2015 plugin and a standalone Git repository tool.
- Octotree β a must-have browser extension to explore code on GitHub
- Tig - text-mode interface for Git
- Sublime Merge - a cross-platform Git client from the makers of Sublime Text.
- Gitless - an experimental version of Git that changes some of Git's underlying concepts
- ghq β Organization for remote repositories
- bash-git-prompt - An informative and fancy bash prompt for Git users
Git is designed for source control management. Extensions help people to extend the idea and push version control to everywhere
- Git Large File Storage β practical solution for versioning large files. supported by GitHub
- Git Virtual File System or GVFS β solution for managing very large Git repository while maintaining speed and efficiency of most operations, in development by Microsoft.
- git-annex β allow managing massive binaries among machines, as if operating a standard git repository. Possible to create a synchronized folder with git-annex assistant
- GitLens - A Visual Studio code extension which helps you visualize code authorship at a glance via Git blame annotations and code lens. Allows you to seamlessly explore Git repositories and gain valuable insights via powerful comparison commands.
People have plenty of options to host their source code
- GitHub β the de-facto git hosting service. Perfect integration with most external services.
- GitLab.com β a free Git repository hosting service served by GitLab EE. Unlimited repositories and private collaborators
- BitBucket β well-known for its free private repository (5 user max).
- Kiln β paid Git repository hosting service
- CodePlex β Microsoftβs free open source code hosting service with many ASP/C# OSS projects
- AWS CodeCommit β a SaaS service provided by Amazon Web Service on high availability infrastructure
- Codeplane β a paid Git repository hosting service with no contributor limit
- Deveo β a paid repository hosting service with support for Git, Subversion, Mercurial, WebDAV
- SourceForge β a long-standing free Git repository hosting service
Or you can host the code yourselves
- Gitolite β a simple with fine-grained access control
- GitHub Enterprise β self-hosted solution provided from GitHub
- Bitbucket Server β self-hosted refrom Atlassian. Good integration with JIRA and other Atlassian products
- GitLab CE/EE β a popular open-source Git (CE) with paid support option (EE).
- Upsource β recent offer from Jetbrains, a famos developer-oriented software company. Code repository hosting feature pending. Free for 10 users. Good integration with YouTrack and TeamCity
- GitBucket β a GitHub clone powered by Scala.
- Gogs β a self-hosted Git Service written in Go.
- Gitea - a community managed fork of Gogs
- GitBlit β Pure Java Stack for managing, view, and serving Git repositories.
- Apache Allura β an open source implementation of project hosting platform
- Phabricator β an integrated set of powerful tools to help companies build higher quality software
- RhodeCode CE/EE β a platform delivering enterprise source code management
Inexpensive branching allows people adopt workflows other than the classic centralilzed workflow
- Pro Git - Distributed Workflows
- Atlassian Git Tutorial - Comparing Workflows
- Gitflow β the most well-known Git workflow model
- GitHub flow β a simple branching model with a single master
- GitLab flow
- Git DMZ Flow
Git provide hooks at commit/push phrase, allowing integration with and code quality checking tool and Continuous Integration (CI)
- pre-commit β a framework for managing and maintaining multi-language pre-commit hooks from Yelp. Extensive support for multiple programming language.
- Overcommit β a extendable Git hook manager written with Ruby.
- git-hooks β tool to manage project, user, and global Git hooks
- quickhook β a fast, Unix'y, opinionated Git hook runner
- husky - Git hooks for Node.js, manage your hooks from your package.json
A curated list of GitHub's Resources.
The awesomeness is currently organized into just a few different buckets:
- Infomation for People Who Are New to GitHub
- Resources for Those Already Familiar With GitHub
- Tips, Tricks, Tools, and Add-Ons for GitHub Power Users
- Novel Uses of GitHub
- Code School's Try Git β If you'd like to better understand Git, one of the technologys that makes GitHub possible, this is a great place to start. No GitHub account required.
- Git-it -- π» π A workshopper for learning Git and GitHub.
- On-Demand GitHub Training β Self-paced, interactive projects created and maintained by GitHub's own Training team.
- Bingo Board -- Play bingo π₯ by sending pull requests!
- Writing on GitHub β GitHub's own guide to using GitHub for more than just software development.
- GitHubGuides β GitHub Training & Guides on YouTube.
- GitHub Pages β Websites for you and your projects. Hosted directly from your GitHub repository. Just edit, push, and your changes are live.
- Filetypes that GitHub can do magic with:
- GeoJSON/TopoJSON β Instantly render maps when you add a GeoJSON file to a repository.
- iPython/Jupyter β Yes, that's right, GitHub also renders
ipynb
files right in the browser. The possibilities are endless. - PDF β View PDFs right in your browser.
- STL files β It's pretty amazing, 3D right in the browser.
- CSV β Data journalists and civic data nerds rejoice, comma separated values right in the browser!
- SVG β Not only can you view scalable vector graphics in the browser, but you can see the difference between versions visually! You've got to see it to believe it. (In fact, you can do this with most image files.)
- PSD β That's right, same idea as SVG, but for Photoshop files!
- GitHub Government Community β Information on joining GitHub's government community β a collaborative community for sharing best practices in furtherance of open source, open data, and open government efforts.
- Classroom for GitHub β Your course assignments on GitHub.
- Fun with GitHub β A fun overview of GitHub.
- GitHub Cheat Sheet β Use this list to test your GitHub knowledge.
- GitHub Universe β Two full days on how to build, collaborate, and deploy great software, presented by GitHub. October 1 & 2, 2015, SF.
- GitHub Desktop β Simple collaboration from your desktop.
- Atom β Did you know that GitHub makes an editor? Use it to write, code, and more.
- Electron β Build cross platform desktop apps with web technologies
- GitHub Buttons β Showcase your GitHub repo's success with hotlinkable GitHub star, fork, or follow buttons.
- Resume β Resumes generated using GitHub.
- Speaker Deck β Share Presentations without the Mess, by GitHub.
- Blocks β This is a simple viewer for code examples hosted on GitHub Gist. (Introduction is here)
- Block Builder β Quickly create, edit, and fork D3.js examples
- GitHub Template Guidelines β Guidelines for creating template files for a GitHub project..
- GitHub Integrations Directory β Use your favorite tools with GitHub.
- GitHub Cheat Sheet β Use this list to test your GitHub knowledge. (A resource so good, it's worth mentioning twice.)
- A collection of awesome browser extensions for GitHub. β Well, the link kinda' says it all.
- Gitter β Chat, for GitHub. Unlimited public rooms and one-to-one chats, free.
- ZenHub β Project management inside of GitHub, including kanban boards and more.
- HuBoard β Instant project management for your GitHub issues (sadly, no free plan, but appears to be open source)
- Overv.io β Agile project management for teams who love GitHub. Kanban baords and more.
- Penflip β Collaborative writing and version control, powered by GitLab (similar to GitHub).
- Gitbook β A modern publishing toolchain. Simply taking you from ideas to finished, polished books.
- Prose β Prose provides a beautifully simple content authoring environment for CMS-free websites. It's a web-based interface for managing content on GitHub.
- Redliner β A tool for facilitating the redlining of documents with the GitHub uninitiated.
- Gatekeeper β Enables client-side applications to dance OAuth with GitHub.
- github-secret-keeper β Microservice to enable GitHub login for multiple server-less applications.
- Hub β A command line tool that wraps git in order to extend it with extra features and commands that make working with GitHub easier.
- Ghizmo β A command line for GitHub, allowing access to all APIs.
- cli-github β GitHub made pretty, within the command line.
- GitHub Dark β A sophisticated dark theme for GitHub.
- github-issues-import β A Python script that allows you to import issues and pull requests from one GitHub repository to another
- Github-Auto-Issue-Creator β A Python script that searches a GitHub repository (locally) and automatically creates GitHub issues for TODO statements, keeping them tracked.
- Problem Child β Allows authenticated or anonymous users to fill out a standard web form to create GitHub issues (and pull requests).
- gitify β All your GitHub notifications on your menu.
- HubPress β A web application to build your Blog on GitHub
- TinyPress β TinyPress is the easiest way to publish a blog on GitHub.
- Issue and Pull Request Template Generator β Generate templates customized to your project, with the help of Cthulhu and Lewis Carroll
- Noteit β Manage your notes at CLI with GitHub Gists.
- Zappr β A free/open-source GitHub integration that removes bottlenecks around pull request approval and helps dev teams to painlessly abide by compliance requirements.
- Migrating to Git LFS β Easily manage huge files in your Git projects, useful for Data Science projects
- Mozilla Festival β Mozfest 2015 Program on GitHub.
- Open Source Society University β Path to a free self-taught education in Computer Science.
- Clef's Handbook β An employee handbook built for inclusion.
- The United States Code β The complete United States Code.
- Le code civil franΓ§ais sous git β French Civil Code on GitHub.
- Gitron β A web game about GitHub based on Tron movies.
- Set Up
- Configuration Files
- Create
- Local Changes
- Search
- Commit History
- Branches & Tags
- Update & Publish
- Merge & Rebase
- Undo
- Git Flow
$ git config --list
$ git config --local --list
$ git config --global --list
$ git config --system --list
$ git config --global user.name "[firstname lastname]"
$ git config --global user.email "[valid-email]"
$ git config --global color.ui auto
$ git config --global core.editor vi
<repo>/.git/config
~/.gitconfig
/etc/gitconfig
There are two ways:
Via SSH
$ git clone ssh://user@domain.com/repo.git
Via HTTP
$ git clone http://domain.com/user/repo.git
$ git init
$ git status
$ git diff
$ git add .
$ git add -p <file>
$ git commit -a
$ git commit
$ git commit -m 'message here'
$ git commit -am 'message here'
$ git commit --date="`date --date='n day ago'`" -am "<Commit Message Here>"
Don't amend published commits!
$ git commit -a --amend
Don't amend published commits!
$ git commit --amend --no-edit
GIT_COMMITTER_DATE="date" git commit --amend
$ git commit --amend --date="date"
$ git stash
$ git checkout branch2
$ git stash pop
$ git stash apply
- {stash_number} can be obtained from
git stash list
$ git stash apply stash@{stash_number}
$ git stash drop
$ git grep "Hello"
$ git grep "Hello" v2.5
Show all commits, starting with newest (it'll show the hash, author information, date of commit and title of the commit):
$ git log
$ git log --oneline
$ git log --author="username"
$ git log -p <file>
$ git log --oneline <origin/master>..<remote/master> --left-right
$ git log --all --decorate --oneline --graph
$ git blame <file>
$ git reflog show
$ git reflog delete
$ git branch
$ git branch -a
$ git branch -r
$ git checkout <branch>
$ git checkout <branch> -- <filename>
$ git checkout -b <branch>
$ git checkout <commit-hash> -b <new_branch_name>
$ git branch <new-branch>
$ git branch --track <new-branch> <remote-branch>
$ git branch -d <branch>
$ git branch -m <new_branch_name>
You will lose unmerged changes!
$ git branch -D <branch>
$ git tag <tag-name>
$ git tag -a <tag-name>
$ git remote -v
$ git remote show <remote>
$ git remote add <remote> <url>
$ git fetch <remote>
$ git remote pull <remote> <url>
$ git pull origin master
$ git pull --rebase <remote> <branch>
$ git push remote <remote> <branch>
$ git push <remote> :<branch> (since Git v1.5.0)
OR
$ git push <remote> --delete <branch> (since Git v1.7.0)
$ git push --tags
$ git config --global merge.tool meld
$ git mergetool
$ git merge <branch>
$ git merge --no-ff <branch>
Don't rebase published commit!
$ git rebase <branch>
$ git rebase --abort
$ git rebase --continue
$ git add <resolved-file>
$ git rm <resolved-file>
$ git rebase -i <commit-just-before-first>
Now replace this,
pick <commit_id>
pick <commit_id2>
pick <commit_id3>
to this,
pick <commit_id>
squash <commit_id2>
squash <commit_id3>
$ git reset --hard HEAD
$ git reset HEAD
$ git checkout HEAD <file>
$ git revert <commit>
$ git reset --hard <commit>
$ git reset --hard <remote/branch> e.g., upstream/master, origin/my-feature
$ git reset <commit>
$ git reset --keep <commit>
$ git rm -r --cached .
$ git add .
$ git commit -m "remove xyz file"
Improved Git-flow
$ brew install git-flow-avh
$ port install git-flow
$ sudo apt-get install git-flow
$ wget -q -O - --no-check-certificate https://raw.githubusercontent.com/petervanderdoes/gitflow/develop/contrib/gitflow-installer.sh install <state> | bash
Git flow needs to be initialized in order to customize your project setup. Start using git-flow by initializing it inside an existing git repository:
You'll have to answer a few questions regarding the naming conventions for your branches. It's recommended to use the default values.
git flow init
OR
git flow init -d
git flow feature start MYFEATURE
git flow feature finish MYFEATURE
Are you developing a feature in collaboration? Publish a feature to the remote server so it can be used by other users.
git flow feature publish MYFEATURE
git flow feature pull origin MYFEATURE
8) Now go to that existing project and create a pull request by pressing the compare and pull request button.
git flow feature track MYFEATURE
Support preparation of a new production release. Allow for minor bug fixes and preparing meta-data for a release
To start a release, use the git flow release command. It creates a release branch created from the 'develop' branch. You can optionally supply a [BASE] commit sha-1 hash to start the release from. The commit must be on the 'develop' branch.
git flow release start RELEASE [BASE]
It's wise to publish the release branch after creating it to allow release commits by other developers. Do it similar to feature publishing with the command:
git flow release publish RELEASE
git flow release finish RELEASE
Hotfixes arise from the necessity to act immediately upon an undesired state of a live production version. May be branched off from the corresponding tag on the master branch that marks the production version.
$ git flow hotfix start VERSION [BASENAME]
The version argument hereby marks the new hotfix release name. Optionally you can specify a basename to start from.
By finishing a hotfix it gets merged back into develop and master. Additionally the master merge is tagged with the hotfix version
git flow hotfix finish VERSION
Collection of
git-tips
, want to add your tips? Checkout contributing.md
- git-tip β A handy CLI to make optimum use of these tips. (Here in Docker container)
P.S: All these commands are tested on git version 2.7.4 (Apple Git-66)
.
- Everyday Git in twenty commands or so
- Show helpful guides that come with Git
- Search change by content
- Sync with remote, overwrite local changes
- List of all files till a commit
- Git reset first commit
- List all the conflicted files
- List of all files changed in a commit
- Unstaged changes since last commit
- Changes staged for commit
- Show both staged and unstaged changes
- List all branches that are already merged into master
- Quickly switch to the previous branch
- Remove branches that have already been merged with master
- List all branches and their upstreams, as well as last commit on branch
- Track upstream branch
- Delete local branch
- Delete remote branch
- Delete local tag
- Delete remote tag
- Undo local changes with the last content in head
- Revert: Undo a commit by creating a new commit
- Reset: Discard commits, advised for private branch
- Reword the previous commit message
- See commit history for just the current branch
- Amend author.
- Reset author, after author has been changed in the global config.
- Changing a remote's URL
- Get list of all remote references
- Get list of all local and remote branches
- Get only remote branches
- Stage parts of a changed file, instead of the entire file
- Get git bash completion
- What changed since two weeks?
- See all commits made since forking from master
- Pick commits across branches using cherry-pick
- Find out branches containing commit-hash
- Git Aliases
- Saving current state of tracked files without commiting
- Saving current state of unstaged changes to tracked files
- Saving current state including untracked files
- Saving current state with message
- Saving current state of all files (ignored, untracked, and tracked)
- Show list of all saved stashes
- Apply any stash without deleting from the stashed list
- Apply last stashed state and delete it from stashed list
- Delete all stored stashes
- Grab a single file from a stash
- Show all tracked files
- Show all untracked files
- Show all ignored files
- Create new working tree from a repository (git 2.5)
- Create new working tree from HEAD state
- Untrack files without deleting
- Before deleting untracked files/directory, do a dry run to get the list of these files/directories
- Forcefully remove untracked files
- Forcefully remove untracked directory
- Update all the submodules
- Show all commits in the current branch yet to be merged to master
- Rename a branch
- Rebases 'feature' to 'master' and merges it in to master
- Archive the
master
branch - Modify previous commit without modifying the commit message
- Prunes references to remote branches that have been deleted in the remote.
- Retrieve the commit hash of the initial revision.
- Visualize the version tree.
- Deploying git tracked subfolder to gh-pages
- Adding a project to repo using subtree
- Get latest changes in your repo for a linked project using subtree
- Export a branch with history to a file.
- Import from a bundle
- Get the name of current branch.
- Ignore one file on commit (e.g. Changelog).
- Stash changes before rebasing
- Fetch pull request by ID to a local branch
- Show the most recent tag on the current branch.
- Show inline word diff.
- Show changes using common diff tools.
- Donβt consider changes for tracked file.
- Undo assume-unchanged.
- Clean the files from
.gitignore
. - Restore deleted file.
- Restore file to a specific commit-hash
- Always rebase instead of merge on pull.
- List all the alias and configs.
- Make git case sensitive.
- Add custom editors.
- Auto correct typos.
- Check if the change was a part of a release.
- Dry run. (any command that supports dry-run flag should do.)
- Marks your commit as a fix of a previous commit.
- Squash fixup commits normal commits.
- Skip staging area during commit.
- Interactive staging.
- List ignored files.
- Status of ignored files.
- Commits in Branch1 that are not in Branch2
- List n last commits
- Reuse recorded resolution, record and reuse previous conflicts resolutions.
- Open all conflicted files in an editor.
- Count unpacked number of objects and their disk consumption.
- Prune all unreachable objects from the object database.
- Instantly browse your working repository in gitweb.
- View the GPG signatures in the commit log
- Remove entry in the global config.
- Checkout a new branch without any history
- Extract file from another branch.
- List only the root and merge commits.
- Change previous two commits with an interactive rebase.
- List all branch is WIP
- Find guilty with binary search
- Bypass pre-commit and commit-msg githooks
- List commits and changes to a specific file (even through renaming)
- Clone a single branch
- Create and switch new branch
- Ignore file mode changes on commits
- Turn off git colored terminal output
- Specific color settings
- Show all local branches ordered by recent commits
- Find lines matching the pattern (regex or string) in tracked files
- Clone a shallow copy of a repository
- Search Commit log across all branches for given text
- Get first commit in a branch (from master)
- Unstaging Staged file
- Force push to Remote Repository
- Adding Remote name
- Show the author, time and last revision made to each line of a given file
- Group commits by authors and title
- Forced push but still ensure you don't overwrite other's work
- Show how many lines does an author contribute
- Revert: Reverting an entire merge
- Number of commits in a branch
- Alias: git undo
- Add object notes
- Show all the git-notes
- Apply commit from another repository
- Specific fetch reference
- Find common ancestor of two branches
- List unpushed git commits
- Add everything, but whitespace changes
- Edit [local/global] git config
- blame on certain range
- Show a Git logical variable.
- Preformatted patch file.
- Get the repo name.
- logs between date range
- Exclude author from logs
- Generates a summary of pending changes
- List references in a remote repository
- Backup untracked files.
- List all git aliases
- Show git status short
- Checkout a commit prior to a day ago
- Push a new local branch to remote repository and track
git help everyday
git help -g
git log -S'<a term in the source>'
git fetch origin && git reset --hard origin/master && git clean -f -d
git ls-tree --name-only -r <commit-ish>
git update-ref -d HEAD
git diff --name-only --diff-filter=U
git diff-tree --no-commit-id --name-only -r <commit-ish>
git diff
git diff --cached
Alternatives:
git diff --staged
git diff HEAD
git branch --merged master
git checkout -
Alternatives:
git checkout @{-1}
git branch --merged master | grep -v '^\*' | xargs -n 1 git branch -d
Alternatives:
git branch --merged master | grep -v '^\*\| master' | xargs -n 1 git branch -d # will not delete master if master is not checked out
git branch -vv
git branch -u origin/mybranch
git branch -d <local_branchname>
git push origin --delete <remote_branchname>
Alternatives:
git push origin :<remote_branchname>
git tag -d <tag-name>
git push origin :refs/tags/<tag-name>
git checkout -- <file_name>
git revert <commit-ish>
git reset <commit-ish>
git commit -v --amend
git cherry -v master
git commit --amend --author='Author Name <email@address.com>'
git commit --amend --reset-author --no-edit
git remote set-url origin <URL>
git remote
Alternatives:
git remote show
git branch -a
git branch -r
git add -p
curl http://git.io/vfhol > ~/.git-completion.bash && echo '[ -f ~/.git-completion.bash ] && . ~/.git-completion.bash' >> ~/.bashrc
git log --no-merges --raw --since='2 weeks ago'
Alternatives:
git whatchanged --since='2 weeks ago'
git log --no-merges --stat --reverse master..
git checkout <branch-name> && git cherry-pick <commit-ish>
git branch -a --contains <commit-ish>
Alternatives:
git branch --contains <commit-ish>
git config --global alias.<handle> <command>
git config --global alias.st status
git stash
Alternatives:
git stash save
git stash -k
Alternatives:
git stash --keep-index
git stash save --keep-index
git stash -u
Alternatives:
git stash save -u
git stash save --include-untracked
git stash save <message>
git stash -a
Alternatives:
git stash --all
git stash save --all
git stash list
git stash apply <stash@{n}>
git stash pop
Alternatives:
git stash apply stash@{0} && git stash drop stash@{0}
git stash clear
Alternatives:
git stash drop <stash@{n}>
git checkout <stash@{n}> -- <file_path>
Alternatives:
git checkout stash@{0} -- <file_path>
git ls-files -t
git ls-files --others
git ls-files --others -i --exclude-standard
git worktree add -b <branch-name> <path> <start-point>
git worktree add --detach <path> HEAD
git rm --cached <file_path>
Alternatives:
git rm --cached -r <directory_path>
git clean -n
git clean -f
git clean -f -d
git submodule foreach git pull
Alternatives:
git submodule update --init --recursive
git submodule update --remote
git cherry -v master
Alternatives:
git cherry -v master <branch-to-be-merged>
git branch -m <new-branch-name>
Alternatives:
git branch -m [<old-branch-name>] <new-branch-name>
git rebase master feature && git checkout master && git merge -
git archive master --format=zip --output=master.zip
git add --all && git commit --amend --no-edit
git fetch -p
Alternatives:
git remote prune origin
git rev-list --reverse HEAD | head -1
Alternatives:
git rev-list --max-parents=0 HEAD
git log --pretty=oneline | tail -1 | cut -c 1-40
git log --pretty=oneline --reverse | head -1 | cut -c 1-40
git log --pretty=oneline --graph --decorate --all
Alternatives:
gitk --all
git subtree push --prefix subfolder_name origin gh-pages
git subtree add --prefix=<directory_name>/<project_name> --squash git@github.com:<username>/<project_name>.git master
git subtree pull --prefix=<directory_name>/<project_name> --squash git@github.com:<username>/<project_name>.git master
git bundle create <file> <branch-name>
git clone repo.bundle <repo-dir> -b <branch-name>
git rev-parse --abbrev-ref HEAD
git update-index --assume-unchanged Changelog; git commit -a; git update-index --no-assume-unchanged Changelog
git rebase --autostash
git fetch origin pull/<id>/head:<branch-name>
Alternatives:
git pull origin pull/<id>/head:<branch-name>
git describe --tags --abbrev=0
git diff --word-diff
git difftool -t <commit1> <commit2> <path>
git update-index --assume-unchanged <file_name>
git update-index --no-assume-unchanged <file_name>
git clean -X -f
git checkout <deleting_commit>^ -- <file_path>
git checkout <commit-ish> -- <file_path>
git config --global pull.rebase true
Alternatives:
#git < 1.7.9
git config --global branch.autosetuprebase always
git config --list
git config --global core.ignorecase false
git config --global core.editor '$EDITOR'
git config --global help.autocorrect 1
git name-rev --name-only <SHA-1>
git clean -fd --dry-run
git commit --fixup <SHA-1>
git rebase -i --autosquash
git commit --only <file_path>
git add -i
git check-ignore *
git status --ignored
git log Branch1 ^Branch2
git log -<n>
Alternatives:
git log -n <n>
git config --global rerere.enabled 1
git diff --name-only | uniq | xargs $EDITOR
git count-objects --human-readable
git gc --prune=now --aggressive
git instaweb [--local] [--httpd=<httpd>] [--port=<port>] [--browser=<browser>]
git log --show-signature
git config --global --unset <entry-name>
git checkout --orphan <branch_name>
git show <branch_name>:<file_name>
git log --first-parent
git rebase --interactive HEAD~2
git checkout master && git branch --no-merged
git bisect start # Search start
git bisect bad # Set point to bad commit
git bisect good v2.6.13-rc2 # Set point to good commit|tag
git bisect bad # Say current state is bad
git bisect good # Say current state is good
git bisect reset # Finish search
git commit --no-verify
git log --follow -p -- <file_path>
git clone -b <branch-name> --single-branch https://github.com/user/repo.git
git checkout -b <branch-name>
Alternatives:
git branch <branch-name> && git checkout <branch-name>
git config core.fileMode false
git config --global color.ui false
git config --global <specific command e.g branch, diff> <true, false or always>
git for-each-ref --sort=-committerdate --format='%(refname:short)' refs/heads/
git grep --heading --line-number 'foo bar'
git clone https://github.com/user/repo.git --depth 1
git log --all --grep='<given-text>'
git log master..<branch-name> --oneline | tail -1
git reset --soft HEAD
git reset HEAD <file-name>
git push -f <remote-name> <branch-name>
git remote add <remote-nickname> <remote-url>
git blame <file-name>
git shortlog
git push --force-with-lease <remote-name> <branch-name>
git log --author='_Your_Name_Here_' --pretty=tformat: --numstat | gawk '{ add += <!-- @doxie.inject start -->; subs += <!-- @doxie.inject end -->; loc += <!-- @doxie.inject start --> - <!-- @doxie.inject end --> } END { printf "added lines: %s removed lines: %s total lines: %s
", add, subs, loc }' -
Alternatives:
git log --author='_Your_Name_Here_' --pretty=tformat: --numstat | awk '{ add += <!-- @doxie.inject start -->; subs += <!-- @doxie.inject end -->; loc += <!-- @doxie.inject start --> - <!-- @doxie.inject end --> } END { printf "added lines: %s, removed lines: %s, total lines: %s
", add, subs, loc }' - # on Mac OSX
git revert -m 1 <commit-ish>
git rev-list --count <branch-name>
git config --global alias.undo '!f() { git reset --hard $(git rev-parse --abbrev-ref HEAD)@{${1-1}}; }; f'
git notes add -m 'Note on the previous commit....'
git log --show-notes='*'
git --git-dir=<source-dir>/.git format-patch -k -1 --stdout <SHA1> | git am -3 -k
git fetch origin master:refs/remotes/origin/mymaster
diff -u <(git rev-list --first-parent BranchA) <(git rev-list --first-parent BranchB) | sed -ne 's/^ //p' | head -1
git log --branches --not --remotes
Alternatives:
git log @{u}..
git cherry -v
git diff --ignore-all-space | git apply --cached
git config [--global] --edit
git blame -L <start>,<end>
git var -l | <variable>
git format-patch -M upstream..topic
git rev-parse --show-toplevel
git log --since='FEB 1 2017' --until='FEB 14 2017'
git log --perl-regexp --author='^((?!excluded-author-regex).*)
git request-pull v1.0 https://git.ko.xz/project master:for-linus
git ls-remote git://git.kernel.org/pub/scm/git/git.git
git ls-files --others -i --exclude-standard | xargs zip untracked.zip
git config -l | grep alias | sed 's/^alias\.//g'
Alternatives:
git config -l | grep alias | cut -d '.' -f 2
git status --short --branch
git checkout master@{yesterday}
git push -u origin <branch_name>
Make sure you follow the following simple set of rules here while trying to contribute.
- Every Pull Request must have a title.
- Every Pull Request must have a description.
- Write the title and description of what you have done in the imperative mode, that is as if you were commanding someone.
- β DO: Start the line with "FIX", "ADD", "IMPROVE".
- β DON'T: Start with "Fixed", "Added", "Adding", "Improved".
- π― Read β How to Write a Git Commit Message!
- Don't end the summary line with a period - it's a title and titles don't end with a period.
- Have fun.
π WPCOUPLE PARTNERS:
This open source project is maintained by the help of awesome businesses listed below. What? Read more about it β
MIT Β© Ahmad Awais
ahmadawais | wpcontentstudio | ahmadbilalme | worwox | mrbilloo | driftikharahmad |
finktanks | MahamBatool | NidaBatool | wpbizreview | ahmedzerar | nighatiftikhar |
a2podcast | usmanworwox | TheWPCouple | alexruf | mrumair | AliRaza1844 |
AdnanMuhib | arximughal | prubianes | saqibameen | Elias504 | shoaibahmedqureshi |
Smith-erin | GayathriVenkatesh | julicheng | WisdomSky | kkdroidgit | luisfmelo |
k0R73z | michaelwright74 | omerl13 | Omkar-Ajnadkar | petrkle | starchow |
darpr | rchung95 | MarkisDev | Burnett2k | SnehPandya18 | sudaisasif |
WajahatAnwar | ybaruchel | alljp | kuwali | Endless7188 |