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
Search - "#git"
-
Git.
The smallest utility made its way to being the largest companies must-have, the most critical part of the whole development landscape.
Using just plain C, Git can shred huge amounts of data insanely fast. It never gets old.
Git is a developer's scalpel.11 -
Senior dev : * doesn't use git *
Me: you seriously should use git...
Senior dev: * still doesn't use git *
Senior dev: * overwrites production files with old files from other computer *
Senior dev: * talks to boss *
Boss: * gets angry at me *11 -
Me: *just playing around with Git on my terminal*
Friend: "Man, you're such a geek, typing your git command on the terminal.. I myself can't use git without the GUI at all"
Me: *stares at him in silence*
Me: "Wait... THERE 'S A GUI FOR THAT?"
*true story when I was in college*40 -
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?50 -
git blame
git fired
git depression
git divorce
git homeless
git commit
git job
git house
git wife --better
exit11 -
Why is the "leave building"command now working?!?!?! Are you sure it's a Git command?? .... Oh shit.14
-
Sometimes I name my project "suicide" so that when I do a git commit I could say that I committed suicide.4
-
Why the fuck did I set up GitHub and all the deploy scripts if your just going to fucking ignore it and edit directly on the server?!?
"Oh, I ran out of time"
DO YOU EVEN KNOW HOW SIMPLE GIT IS?!?!?
"git add file
git commit -m 'Queef farm'"
AND YOU'RE DONE!12 -
You know you messed Git hard when your commit graph started to look like November Rain on Guitar Hero.4
-
The superpower to perform version control on reality. (Git)
Imagine this universe (the current branch), which is made up of a series of events (commits).
Having this ability to allows us to:
- undo events (git reset/git revert)
- reorder events (git rebase)
- transfer to another universe (git checkout)
- derive a new universe from current universe (git checkout -b)
- delete a universe (git branch -D)
- apply an event from another universe (git cherry-pick)
and my favorite:
- merge universes and their events (git merge)
we have to resolve conflicting events, of course.
What else? ;)8 -
git status
git add .
git commit -m "Minor changes.."
git push
...
git status
*closes terminal*
...
"Fuck that char in that variable name isn't meant to be a capital!"
*makes change*
git status
git add .
git commit -m "Minor changes.."
git push
...
git status
*closes terminal*10 -
I forced my friends to use git(hub) as vcs because their project was in a usb-to-usb state, which was unacceptable for me. So I offered them my help and uploaded it (with a little bit of a forced consent) to github, to end this misery. Of course I helped them the basics of git. Now they automatically use git(hub) as vcs and to share their code.
I feel proud for this :)10 -
Everyone in my company prefers solving git issues rather than `rm -rf` & `git clone`
Feels like I'm working with a team of geniuses. 😂13 -
I "Git Pushed" my friend to "git commit" with a girl he likes for long time
But now my other friend wants to "git rebase" on top of her ....WTF
Now need to resolve this merge conflict 😂😂😂7 -
Went into bed with peace in mind. Updated my website and everything working perfectly. Tonight I'll have a good sleep.
Jumped from bed all of a sudden :
GIT COMMIT! GIT PUSH!1 -
> git commit -m 'fixing what I broke earlier'
> git pish
> git: 'pish' is not a git command. See 'git --help'.
Did you mean this?
push
> you know I meant push, why can't you leave me alone and just do it13 -
I just started using git. it is unbelievably useful. What an idiot I was that I didn't start using it earlier. I LOVE GIT!3
-
Every time I mess up my git branch I usually find that its pretty futile to fix it with fancy commands like 'git reset', 'git prune', 'git rebase', etc. I usually find it easier to just start over from scratch.
They should really add a command for that
'git fuck-it-start-over'9 -
Don't do "git pull" quickly. Always do a "git fetch" THEN "git log HEAD..origin" OR "git log -p HEAD..origin". It is like previewing first what you will "git pull".
OR something like (example):
- git fetch
- git diff origin/master
- git pull --rebase origin master
Sometimes it is a trap, you will pull other unknown or unwanted files that will cause some errors after quickly doing a git pull when working in a team. Better safe than sorry.
Other tips and tricks related are welcome 😀
Credits: https://stackoverflow.com/questions...5 -
Probably posted before, still funny!
alias yolo='git commit -am "DEAL WITH IT" && git push -f origin master'1 -
Sometimes I forget that not all Terminal commands begin with "git."
git ls
git less fileName.ext
git cd ..3 -
Don't want to break your commit streak on Github.
So you change one line and :-
git add .
git commit -m "Minor Tweak"
git push
VOILA ! the box is green for today . *Evil Smile*5 -
got commit
got add
got pull
got push
...
Typos.. every.. Damn.. time.. so I assigned an alias for got = git9 -
Night before flying internationally includes the following checklist:
- check VPN works, can access frontend sites and hit the backend
- git push4 -
!rant.
Here's some useful git tricks. Use with care and remember to be careful to only rewrite history when noones looking.
- git rebase: powerful history rewriting. Combine commits, delete commits, reorder commits, etc.
- git reflog: unfuck yourself. Move back to where you were even if where you were was destroyed by rebasing or deleting. Git never deletes commits that you've seen within at least the last 50 HEAD changes, and not at all until a GC happens, so you can save yourself quite often.
- git cherry-pick: steal a commit into another branch. Useful for pulling things out of larger changesets.
- git worktree: checkout a different branch into a different folder using the same git repository.
- git fetch: get latest commits and origin HEADs without impacting local braches.
- git push --force-with-lease: force push without overwriting other's changes5 -
git commit -m "last"
git commit -m "last1"
git commit -m "real last"
git commit -m "real last 1"
git commit -m "real real last"8 -
I forced myself to use git on my latest projects. And the more I use it, the more I love it. I can relate to all the git-love here on devRant.21
-
When I first started using Git, I didn't understand the purpose of the 'commit message' and branches.
So I automated the 'git add .', 'git commit -m "update"' and 'git push origin master' so I could update my git repo faster, with one command 😂1 -
One day Linus Torvalds will make a statement about git like: "Why is everybody using this? It was just a joke!"2
-
I forgot to git fetch, so I spent quite a while doing exactly WHAT MY TEAMMATE HAD DONE JUST HOURS AGO3
-
To all those people that have Git alliases like:
"gc" = "git clone" or "ga" = "git add"
What do you do with all that extra saved time?15 -
Remember kids, clear out any login credentials before doing git commit and git push!
/smacks himself6 -
Wanna gently annoy your coworker? Every time they send you an idea about something code related, just respond with:
"git checkout shitty_ideas"3 -
Me: How can I delete pushed commits from origin?
Colleague: Just do git reset --hard and then git push -f
Me: But this is dangerous
Colleague: Wait, I'll do it myself
Colleague: Done
Me: But nothing happened
Colleague: Fuck. I just removed all changes on my own branch2 -
git reflog, git reflog...git FUCKING reflog!!!! Ah fuck this, I'm taking the kids out. 3hrs later.... Oh shit, i was in the wrong directory. A good fresh air clears the mind.2
-
:OOO Varianto is kickstarting another new deck!! This time with git
https://kickstarter.com/projects/...
Also full deck sauce
https://varianto25.com/kickstarter/... -
Friday. 17:56. Time to go home.
> git add *
> git commit -m 'wip, feature almost done, need to test'
> git pu... [BIG FAT BSOD]
fuck it, I'm out13 -
Enough is enough! I can't do it anymore!
...
alias pm='python manage.py'
alias ga='git add .'
alias gc='git commit -a'
alias gi='git init && touch .gitignore && printf ".idea \n venv \n node_modules \n out \n *.iml \n *.log \n build \n target" > .gitignore'
alias gp='git push'
alias gps='git push --set-upstream origin master'
alias gr='git remote add origin'
...
Much better :D12 -
So I started to read the book „Mastering Git“ by Jakub Narębski (*) and I am so impressed of how much more git is than just commit/push/pull 😳
(*) https://packtpub.com/application-de...1 -
$ git add .
$ git commit -m "This HAS to be online soon"
$ git push
*merge conflict*
*did not look at difference*
*using mine*
$ git commit -m "resolv merge conflict"
$ git push
$ ssh root@x.x.x.x
# git pull
# cd /path/to/webapp
# npm run production3 -
So I am conducting an introductory seminar on git and GitHub for juniors and as per my knowledge I've drafted this outline, please add your inputs..
The seminar will be of 1 day only
1. Install and configure Git and Github
2. Digital Signature mapping
3. Git init
4. New Project with HTML
5. Configure remote (git remote add <origin> <url>) ends with .git
6. Git commit (git commit –m “Title” –m “commit message”)
7. Pushing git push (git remote push origin master)
8. Git commit –amend
9. Git pull (git pull origin master)
10. Git checkout (git checkout –b new_branch_name)
11. Do some changes
12. Git push new branch (git remote push origin new_branch_name)
13. Git switch branch (git checkout <name_of_existing_branch>)
14. Pull requests
15. Git log (git log –oneline –graph)15 -
Accidentally rm -rf a git repo, one of the branch still not pushed to remote yet. I managed to use file recovery software to recover the .git folder, any idea what to do next?27
-
Lead messed up the Git workflow (New repo), ask me to fix it. And when I said that we better do it from first properly, asked me if I even know git 🙄 Feel insulted.3
-
Dear git,
FUCK YOUR FUCKING FUCK SHIT .GITIGNORE FILE! WHY CAN'T YOU JUST FUCKING REMOVE THE IGNORED FILES FROM THE VCS? EVEN GIT RM --CACHED --FORCE DOES NOT WORK WTF
TL;DR
"git" your shit done.
Yours sincerely
Scrumplex3 -
Sometimes I think that git is like a drug. After getting past the initial learning curve, you use it in every single one of your projects. Sometimes I wonder how have I ever survived without git before.3
-
Fuck me and fuck merges and fuck conflicts!!!
I still love you Git but sometimes you are a harsh mistress.7 -
Honestly, without git version control I wouldn't know how I could manage my project properly. Git is awesome in so many aspects <34
-
Me: we should take this project a little more serious, follow the coding standards and please let us use git!
Pal: Oh sure.
//made a new repo and the first commit, sent the link and prepared everything (Granted access etc.)
//2 weeks later
Me: What's up, I already got quite some commits and you haven't pushed anything so far.
Pal: Pushed? what do you mean?
Me: I'm the talking about the git repo, I'm the only one contributing.
Pal: Oh yeah git, I installed it but I have no idea how that stuff works. I opened Git gui but i don't know what I'm supposed to do. I got everything in the Dropbox tho.
Me: ... ... ... FUUUUUUUUU WHAT THE FUCK MATE ARE YOU SHITTING ME, THE HELL DO WE HAVE GOOGLE FOR AND WHY DIDNT YOU ASK, LIKE WTF SERIOUSLY I EXPLICITLY TOLD YOU TO USE GIT.
😣2 -
I think of git as if it was my dog. For added fun name your remote "slippers". Then you can exec "git fetch slippers"2
-
Turns out deleting a git branch also deletes your unchanged changes fuckkkkk
Well as good a time as any to learn how to use 'git fsck' and manually sort through hundreds of dangling blobs
FML7 -
Dont commit before you see this. Here's Adrianna, she thinks she founded GIT.
https://forbes.com/video/...3 -
Git: the occasionally frustrating, dangerous, and infuriating VCS you can't believe you were living without.
-
I think the reason why git beginners have a hard time with it is because the api is a bit untuitive.
For example: if you want to "unstage" staged changes, you run git reset, and if you want to "delete" those changes from your working copy, you git checkout those files.
But then, you find out that you can do all of that if you git add . and git reset --hard.
So you're like "huh..."
And then you discover that if you end the resethard with a branch name/commit id then you also make current branch point to the commit or that branch/commit (respectively).
So you're like "huh..."
And also if you add a commit id or branch name to git checkout, you change the current branch to specified/enter detached state with HEAD pointing to that commit (respectively).
Oh and you don't use git branch to create branches, you use git checkout -b because it's a lot shorter.
So here's a rundown: git reset mutates things related to files, but also mutates things related to branches.
git checkout also mutates things related to files and mutates things related to branches too (in a diff way). Also, creates new branches.
I don't think this is intuitive. We users use the same commands for different purposes with just a different flag.
Commands shouldn't mutate different types of things. But don't composite commands (as in, "smart" commands that mutate different things) shoudln't be a flag in an existing command, it should be a single new command of its own.
Maybe if I reread the internals of git now, I'll be able to disgest the dozens of technical terms they throw at you (they are many). And in my mind, the api will cognitively fit to the explanations.
Here's another one that feels weird too.
If you want to make your changes start on top of someone else's commit, you do git rebase.
But git rebase -i can be used for that, and also to delete, modify changes or message of, reorder or combine previous commits of the current branch.
Maybe the reason why several things we do overlap with the same commands is because they internally do similar things, and while not separating those commands might make it less intuitive, it makes them more sensible? i dunno...
disclaimer: I'm not setting this opinion in stone though, and am aware that git was created by one of the most infuential programmers.6 -
One day i started to code.
One day i was told you will not code without git.
Many days i lost code on git because i was ignorant.
Today i reset the act of commiting without losing all my shit.
Git reset --soft HEAD^
I didnt event sweat it ;)
Today i feel like half a boss!!! -
Every other day, Git is the best version control ever. Today, got damn it Git, why can't it just work7
-
my company uses svn for source control. just found out the guy in charge of the repo actually uses git and just has all developers use svn because "there's less of a learning curve". WHY?!?! Git is so much better!4
-
Something to cheer you up mid-week:
> alias yolo='git commit -am "DEAL WITH IT" && git push -f origin master' -
Wondering how many people use git cmd and how many use different git clients.
I regularly use git cmd. I made a transition from clients a while back because I wanted to learn more about how it actually works and it works just fine for me, except when I have to google something I don't remember (like how to revert local commit)
Git clients will for sure do abstraction which can be both good and bad, but I'm wondering if there are any definitive pros for clients.12 -
I love git stash.
It's helps a lot for doing refactors to me. I guess it's not the most complex workflow, but it wasn't obvious to me when I started with git. Let me explain.
Refactors. As you start writing the first lines of a refactor, you start to notice something: you're changing too many things, your next commit is going to be huge.
That tends to be the very nature of refactors, they usually affect different parts of code.
So, there you are, with a shitload changes, and you figure "hey, I have a better idea, let me first do a smaller cohesive commit (let's call it subcommit) that changes a smaller specific thing, and then I'll continue with the upper parts of the refactor".
Good idea, but you have a shitload of changes nearly touching every file in your working copy, what do you do with these changes? You git stash them.
Let's say you stash and try to do that smaller "subcommit". What sometimes happens to me at this point is that I notice that I could do an even smaller change inside this current "subcommit". So I do the same thing, I git stash and I work on that even smaller thing.
At some point I end up `git stash pop`ing up all these levels. And it it shows that git stash is powerful for this.
* You never lose a single bit of work you did.
* Every commit is clean.
* After every commit you can run tests (automated or manual) to see shit is still working.
* If you don't like some changes that you had git stashed, you can just erase them with git reset --hard.
* If a change overlaps between a stash you're applying and the last "subcommit", then
if they differ, git shows conflicts on the files,
if they are identical, nothing happens.
with this workflow things just flow and you don't need to wipe out all your changes when doing simpler things,
and you don't need to go around creating new branches with temp commits (which results in bloated temp commits and the work of switching branches).
After you finish the refactor, you can decide to squash things with git rebase.
(Note: I don't use git stash pop, because it annoys the fuck out of me when I pop and you I get conflicts, I rather apply and drop)4 -
To all Git Gang members,
It's overwhelming to see the growth of git gang over a single night.
Welcome everyone..
Lets share the world's best git rants, git hacks and git-ish puns..
git add ./\*.rants
git commit -m "gitGang in devRant"
git push
Feel free to join at https://discord.gg/zPEuRzn
New members are always welcomed.. :)1 -
Cleaning up after yourself if so damn important. Even your git repos:
# always be pruning
git fetch -p
# delete your merged branches
git branch --merged | grep -v master | xargs -n 1 git branch -d
# purge remote branches that are merged
git branch -r --merged | grep -v master | sed 's/origin\///' | xargs -n 1 git push --delete origin -
When the fire alarm at your company goes off and instead of saving your life or thinking about your family your first thought is
git commit
git push
...7 -
For the first time in my life I removed a wrong commit with git rebase and I did not made a mess.
More then 10 years of using git and keep learning.6 -
git checkout origin/develop
git status
You are not currently on a branch.
Only computers and nerds can argue like that.
Expected behavior: I'm on branch develop, but nevermind, let's overcomplicate everything.9 -
Fuck off git!
Why the fuck is a simple "git status" getting stuck? Is it even gonna return something by the end? How long am I supposed to wait?
Ffs 😡😡😣26 -
git rebase > git merge
I'm honestly tired of colleagues completely fucking up the git history along with creating conflicts for no reason at all.
How do you even manage to "recommit" changes when merging?
I can't even squash properly because there are 5 merge commits on the feature branch. Fuck off8 -
Git should rename their commands to past tense verbs, so it can be "git merged!" (get merged), etc.3
-
What Git client are you using? Also, what's a freemium Git client that is cheap? Sorry I'm not a fan of monthly subscriptions (hi gitkraken and Git tower) Thanks! 😎22
-
Learning git continues..
So I started learning git on an actual project and pushed all commits on master.. after the project had been completed I gave more time learning git and felt like an idiot...now I'm efficiently trying to learn git...4 -
My friend asked me to set up his git for him
$ git config --global alias.co status
$ git config --global alias.br checkout
$ git config --global alias.ci status
$ git config --global alias.st commit3 -
Pretty difficult to control bad rebasing so... merge for the win!!! #Git #developerproblems who is with me??
-
What would you prefer ? Mercurial or Git? why should i use mercurial and why not git? i am confused.12
-
Am I the only dev who need to git commit && git push everytime I've done more than I would like to redo in case my computer dies?3
-
Git tip: Before doing "git clean -fd" always think twice and backup the whole folder manually before doing that. Take it from me.
Also be careful with, "git pull" 😩13 -
'I'll fork you'
Anyone know of some Git puns?
I'm tutoring a group of students (university) on using Git effectively in a team. Anything to make it more humorous would be awesome :)5 -
Learned git, decided, imma use this while I make a little game in Java, couple days later, I find out that net beans has git INSIDE of it... :/ ....3
-
When you run some dangerous git commands, then realise you're in the wrong repo... oops
Luckily I didn't lose anything -
If git merge automatically performs a commit to the main branch, how do we add a message to that commit?16
-
git suicide:
git() { if [[ $@ == 'suicide' ]]; then git reset --hard origin/master; git push origin master --force; fi }2 -
when my Git Bash got "died waiting for dll loading" issue, and the only solution is to shutdown cygserver2
-
if you're new to git, becareful not to do something like git reset --hard
it works similar to
git checkout --
rm -rf.
and deletes your files that haven't been checked in3 -
I was discussing something about git today with a colleague and then it hit me. Git push --force is like rape. You don't want to push? I'll force you to😂
-
Goodjob Self, you fucked up your Git local repo.
```
[ git checkout master || git stash ]
fatal: git-write-tree: error building trees
Cannot save the current index state
```2 -
temp commits are generally more useful than git stash.
instead of stashing, do a commit with a message like "THIS IS NOT A COMMIT, DON'T INCLUDE THIS". with some discipline you can then go back to your branch, `git reset --soft HEAD~1` and voila, it's similar to a `git stash pop`.
but it's better because you can do this in multiple branches at the same time and there's no fear of accidentally dropping some stashed commit.5 -
Fire at work place.
Normal People: Immediately run from the gate.
Programmer: Git add, Git commit, Git Push, realize fire on the gate, jump from the window.1 -
Update local removed git branches
You can update the removed branches on your local machine by
git fetch --prune --all3 -
Nothing compares to the amount of times I cloned a git repository because I messed a commit back when I first learned git
-
Git's fucked, I guess I have to retype my website from memory. :/
```
git restore --source=HEAD :/
```2 -
Use
git branch --merged
to get, you guessed it, all the branches you have merged.
Use
git branch -d <branch-name>
To delete a branch if it has been merged (use -D for forced)
And Use,
git branch --merged | egrep - v "(^\*|master|dev)" | xargs git branch - d
To delete all the branches that you have merged (but not anything with master/dev in their names)
Sorry for the formatting, I don't know how coder formatting works on DR..4 -
Thanks to one of my colleagues, I have learned that there is a git command that convert HEADless piece of tree into a branch. Thank you git switch. Also, thank you colleague.1
-
git isn't as solid as people believe.
Yes, it's used by million of companies. But it's not so solid35 -
I learnt more about git and how it goes about doing its stuff.. And decided to bestow that wisdom.upon the world..
https://linuxfromanoobie.wordpress.com/... -
"fatal: detected dubious ownership in repository" - if git finds no conflict, it will always find other ways to cause trouble4
-
Can you use version control on a git repo? I mean put a git repo inside a git repo so you can commit while you commit... :P7
-
On my free time I was looking for software where I could visualize the shape of the git graph to sort of reflect Git Flow. What I found was a bunch of git GUI's that list features that normal git already has:
- "undo local changes!"
- "squash commits!"
- "undo branch deletions!"
Da heck people actually pay for this?3 -
What's your favourite Git client and why? Mine is a combination of git and tig in the command line.7
-
Was exhausted after coding for a full day, was going to commit all the work at the end of the day. Then my brain snapped: wanted to hit `git add .`, hit `git checkout .` instead.
Lesson learned (the hard way): "commit fast, and commit often"1 -
Is there any git gui that allows to revert just one file? Gitkraken is amazing but really sucks outside of basic git operations
-
Had to help my buddy run a git workshop today and... He didn't git init and wondered why it wouldn't work..
-
Want to open all the files changed in a PR?
> code $(git diff master --name-only)
#git #vscode #vscodehacks4 -
Git is overrated. There's absolutely no good reason that `git add` should be default to call before `git commit`, if people don't want files added that should be the exception not the rule. But where it all really falls apart is mono repos. There's no good way to make a repo inside a repo, which is fucking stupid. There's no good way to clone just a chunk of a repo, which is fucking stupid. And -- just in general -- every aspect of git feels like it wasn't designed to be usable. For instance: there should be a command `git save "message"` which does the default `git add ., git commit -m "message" git push`. Or rebasing, that doesn't need to be so hard at all.
This is just a rant and all, but I'm so tired of git being clunky and poorly designed from a UX perspective. And not supporting mono-repos for shit.13 -
A person who just starting out ask me about git.
I explain what is "init" , "remote" , "add" , "committing" everything was going well until vim happen.
I just refer him to some beginner friendly tutorial about git and give him a link to git client tool.
How do you guy learn about git? When I stop to think about it git have lot of features.9 -
https://linuxfromanoobie.wordpress.com/...
The Git series is getting larger and larger. As i get into more complicated topics day by day , i request git geeks and beginners alike to take a look at the above and provide feedback if possible..1 -
I messed up something with my git and now it opens git log everytime in vim, which i don't want. Is there any way I can just print it using less or cat and not open in vim?1
-
I created a short tutorial about git merge and rebase. Hope that you will find it interesting! Any feedback is very welcome :) https://dev.to/lmtx1/...3
-
Gotta love git. Every time I look for something I don't know I learn about some new fun command like
git update-index --really-refresh
And yes, there's a regular refresh command as well :) -
Anyone knows some good resources about git?
I use it everyday - but only the basic add, commit, push, merge commands. I'd like to get a deeper understanding of git and of different workflows (like working with rebasing).
So if anyone has a recommendation for a book or something where everything is at one place - please let me know 😀1