git stackoverflow vs gui - jmfayard/drafts GitHub Wiki
Real Developers Don't Use a git GUI. Instead they Copy/Paste From StackOverflow
40 git use cases problmeatic enough that they were stack-overflowed millions of times each
... and their trivial solution in JetBrains IDEs: IntelliJ IDEA, Android Studio, WebStorm, PHPStorm, PyCharm, ReSharper Rider, CLion, RubyMine, AppCode, GoLand
Introduction
TK
How do I undo the most recent local commits in Git?
Git view:
- Select Commit
Drop commit
11.4 million views
How do I delete a Git branch locally and remotely?
Branch view:
- Select Branch
DeleteDelete tracked branch
10.1m views
How do I rename a local Git branch?
Branch view:
- Select current branch 'current'
New branch from 'current'
4.4m views
How do I undo 'git add' before commit?
Commit view:
- Unselect files
4.5m views
How do I force "git pull" to overwrite local files?
- Commit view
- Select all files.
- Commit with message WIP
- Branch view
- Fetch (top-right corner)
New branchwith name my-branch-old- Select branch my-branch
Delete- Select branch origin/my-branch
Checkout
6.9m views
How do I check out a remote Git branch?
Branch view:
- Select `some-remote/some-branch
Checkout
7.1m views
How to remove local (untracked) files from the current Git working tree
Commit view:
- Select untracked files
Delete
3.1m views
How to modify existing, unpushed commit messages?
Git view:
- Select commit
Edit commit message
3.1m views
How do I revert a Git repository to a previous commit?
Git view:
- Select commit
New branchorReset current branch to here- select either
Soft,Hard,Mixed,Keep
- select either
8.7m views
How do I make Git forget about a file that was tracked, but is now in .gitignore?
Ok this one is nasty and don't have a clear answer answer either in StackOverflow nor in my IDEA. It is also rare. Googling probably the best solution here.
1.9m views
Move the most recent commit(s) to a new branch with Git
From
master A - B - C - D - ETomaster A - Bnewbranch \ C - D - E
- Branch view
New branch- with name newbranch
- uncheck
Checkout branch - You are still on master
- Git view
- Select commit B
Reset branch to hereHARD
1.5m views
How do I discard unstaged changes in Git?
Commit view:
- Select files
Rollback
3.0m views
How to change the URI (URL) for a remote Git repository?
Find Action>Manage Remotes
3.0m views
How do I reset or revert a file to a specific revision?
Find Action > Compare with Branch
2.6m views
How do I push a new local branch to a remote Git repository and track it too?
Find Action > Push
4.9m views
How do I resolve merge conflicts in a Git repository?
Find Action > Resolve Conflicts
3.2m views
How do I add an empty directory to a Git repository?
Same as in the command line, you commit an empty file
`my-directory/.gitempty
1.3m views
How to determine the URL that a local Git repository was originally cloned from
Find Action > Manage Remotes
3.8m views
How do I squash my last N commits together?
Git view:
- Select commits
Squash commits
2.8m views
Undo a Git merge that hasn't been pushed yet
Git view:
- Select commit before the merge
Reset current branch to here...Hard
2.9m views
https://stackoverflow.com/questions/7244321/how-do-i-update-or-sync-a-forked-repository-on-github
Find Action>Manage Remotes- Add the upstream URL if necessary
Find Action>Fetch- Git View
- Select branch
upstreamm/master Reset current branch to here...Soft(keep all your local changes)
- Select branch
- Git View
- Do one or more commits
1.1m views
How do I remove a submodule?
Real answer is to never use git submodules
1.2m view
How do I "git clone" a repo, including its submodules?
Real answer is to never use git submodules
1.3m view
Make an existing Git branch track a remote branch?
Find Action>Push- Enter name of the branch you want to track
1.6m views
How do I delete a remote tag?
Git view
- Find commit with the tag my-tag
Tag 'my-tag' ...DeleteDelete on remote
1.6m views
How to view the change history of a file using Git?
Find Action > `Show History>
2.1m views
How do I stash only one file out of multiple files that have changed?
Find Action > Shelve Changes
1.1m views
How do I get the current branch name in Git?
It's in the IDE in the bottom-right corner.
2.5m views
Geez, so much for this one? WTF git?
How do I get the hash for the current commit in Git?
Git view
- Select commit
Copy reviesion number
Geez that's also a simple one.
1.2m views
How do I remove a directory from a Git repository?
Delete repository and commit.
1.7m views !!
How do I untrack a file from a Git repository?
That one is not in IDEA but you can implement an External tool.
3.0m views
How do I fix a Git detached head?
Branches view
New branch
2.1m views
How to get just one file from another branch?
Find Action > Compare With Branch
1.1m views
Why do I need to do --set-upstream all the time?
You don't in IntelliJ
1.2m views
What to do when git push requires username and password?
Usually I need to switch remote URLs from HTTPs to SSH
Find Action > Manage Remotes
1.7m views
How to remove remote origin from a Git repository
Find Action > Manage Remotes
1.1m views
How to reword/reorder/merge/squash multiple commits?
Git view
- Select last relevant commit
Interactively rebase from Here
I actually did'nt know that one, it's very nice!
__1.2m views