Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Oh! Oh ! I've been using one of these for a while now 😊
git branch - - merged....
Aliased to "spring" for "spring cleaning" -
joas18917yIf you don't know git, this site won't help you either:
https://git-man-page-generator.lokaltog.net/... -
@Bitwise On the other hand wget <full github url>.diff | git am -3 && git add -p...
Interactively staging snippets of code from any github page to your current working branch (assuming the github page is showing any relevant changes). I've used this to quickly steal configs from unrelated repositories. -
alias git-check='echo "↓$(git rev-list --left-right --count origin/master...)↑"'
To show how many commits I'm behind and ahead of origin/master. -
I simply love the program, it is simple and does (quite a ) few things and does it well!
My fav alias is Git history which is my custom format of Git log -
git yolo => git commit -am "Stuff" && git pull -f && git push -f
I used to do that :/, one of my coworkers didn't like it
PS don't kill me -
Rocket3G2007yI also love `git cherry-pick commitHash`, which applies the commit to the current HEAD, if applicable.
Also `git bisect` is very useful if you know that a bug is introduced, and you want to know own which commit introduced that bug. It uses binary search. :) -
brynzky217y
-
@Rocket3G Bisect! I use that in a script combined with composer & npm/yarn, put every dependency version upgrade in a seperate commit, run unit tests. Rebase/squash on success, bisect/test on fail to find packages with breaking changes 😉
-
Masta3017yI learnt git basics 4 years ago, using command line. But since I feel comfortable with it I'm lazy, so I just use SourceTree. It has many ui bugs but it does a great job as an everyday git client. I could go back to cli but it would feel uselessly painful.
But the real thing I love is git-flow. That simple workflow totally change the game: it's so clean and efficient, it simplifies team work a lot, it helps using semver, and once you get it it's actually a very obvious way to work. -
@Masta I think it's awesome that gui clients exist. Git would be hard to sell to less neckbeardy types if all you had was the terminal.
Still, I personally like to "reformat" bigger complicated branches before making PRs, using rebase -i, squashing and rewriting commit messages. I move chunks of edits between commits, so single commits represent a "package" of changes — that way, they're easier to review, revert or browse through in the future. -
@yendenikhil It's actually not the same since git status -sb only shows the difference between your branch and its remote counterpart (If I'm not mistaken here).
I wanted to compare to origin/master specifically no matter the branch I'm on ;) -
@TheSilent isn't it bit dangerous? I mean origin master and your local branch is evolving differently as time passes!
-
@yendenikhil That's exactly the reason I use it. I normally rebase my branch when I'm behind master. So what I do is git-check and then rebase of necessary ;)
-
Catdow5337yglol
For git log --oneline
[G]it [L]og [O]ne [L]ine
It's easy to remember, it is used frequently and it has lol in it. Top that. -
If you use zsh, it already provides you with so many aliases:
gst - git status
gco - git checkout
glo - git log
.....
The list goes on and on -
@Bitwise hey thanks mate. I didn't know that git format-patch was important too. I'll study it later 😎
-
@junners Careful, learning is an addiction which eventually leads to the realization that others are blissfully retarded, the depressing revelation that you're not going to change that, resulting in a final state of permanent misanthropy.
But fine, join the club. -
junners4807y@bittersweet addiction indeed. A sweet addiction which you have to bust your ass and bang your head to the wall multiple times before saying "Aha, piece of cake!!"
-
plusgut60137y@Bitwise I'm in!
But please let us not combine the coffee-house and the acid. I prefer it chill when I'm tripping. -
Root797677y@bittersweet I think I've already reached terminal misanthropy :<
@Bitwise That's quite the compliment. Thank you 😊 -
I’m most familiar with git revert 3daf84bce20 —no-edit because of stupid bugs that nobody caught.
-
@creator go wash your terminal with water and soap you filthy man.
(although, no problem if you fully "own" the remote feature branch — like when working solo on a PR) -
I still forget to put my commit messages inside "" sometimes.. so well done you!
-
I would just like to say thank you to everyone who commented here and made this thread the most useful rant i ever saw. :)
-
I learned a new one .. not related to git commands but useful in cmd :
1) cd .. :to get back one diredtory
Eg you are in cd/Desktop
>> ~/Desktop $ cd ..
>> ~$
2) while in a repo, if you want to go to folder, just type 2-3 characters of its name after cd and press TAB, it will auto-complete ;)
>> ~ $ cd Des[press Tab will make it Desktop/]
>> ~/Desktop $
Related Rants
When you stare into git, git stares back.
It's fucking infinite.
Me 2 years ago:
"uh was it git fetch or git pull?"
Me 1 year ago:
"Look, I printed these 5 git commands on a laptop sticker, this is all I need for my workflow! branch, pull, commit, merge, push! Git is easy!"
Me now:
"Hold my beer, I'll just do git format-patch -k --stdout HEAD..feature -- script.js | git am -3 -k to steal that file from your branch, then git rebase master && git rebase -i HEAD~$(git rev-list --count master..HEAD) to clean up the commit messages, and a git branch --merged | grep -v "\*" | xargs -n 1 git branch -d to clean up the branches, oh lets see how many words you've added with git diff --word-diff=porcelain | grep -e '^+[^+]' | wc -w, hmm maybe I should alias some of this stuff..."
Do you have any git tricks/favorites which you use so often that you've aliased them?
rant
powerful
<3
git