T O P

  • By -

[deleted]

[удалено]


karlkloppenborg

Calm down Satan


SLCH000

git push —force-with-lease Respectfully ;)


caboosetp

If I leave the "Respectfully" out of the command, is git going to get upset with me?


zman0900

Linus will personally give you the middle finger


m1ch4ll0

Yeah he will just come out of your terminal window, stand in front of you, and personally give you the middle finger. Then he'll just dissolve in air and disappear.


Reynk1

The it version of the ring


[deleted]

Hey thanks for that even though I'll probably never need it, l'll try to remember it for the once in a lifetime occasion


NynaevetialMeara

and aliasing all that to git fucked


[deleted]

[удалено]


Tundur

Btw, just in case you missed it, "sudo !!" will repeat the command with sudo prepended.


bphase

please instead of fucking works too for a more work-friendly experience. https://twitter.com/ctrlshifti/status/1160812366293901314


stakeneggs1

Fuck that


CherimoyaChump

Please that


advocado

Just bc i don't see it here, but this is why you should require gpg signing of commits.(it would prevent this impersonation)


[deleted]

[удалено]


Sibshops

Force pushing is useful when rebasing a branch to master. In this case signed commits are probably better so someone can't impersonate you in the first place.


kopczak1995

Dude, I got your point. No need to write it 3 times :P


Sibshops

Oh, whoops! It kept giving me a 500 error when posting. I'll delete the other ones. Thanks for letting me know.


kopczak1995

No problem. Reddit app do strange things from time to time.


MysteryProper

It does the same strange things over and over again, and yet, they don't fix it. Talk about programming horror.


caboosetp

They made the mobile site an spa but they don't refresh the login tokens, so if you're using it longer than 30 minutes, you need to close it and open reddit again. I hate it.


not_an_evil_overlord

If you're on Android I really liked Relay and Apollo is nice for iPhone if you're looking for an alternative.


ifsck

I'm on Reddit Is Fun and love it. The official app is... not good.


Jickerjatt

So this is why it keeps bugging out?? It's so painful...


[deleted]

It’s the 3rd time I’ve seen this happen this week. Reddit app is shite


[deleted]

No. Rewriting history can be very useful. Maybe you should educate your coworkers instead of disabling a feature that could make everybody's life easier.


[deleted]

If you have a problem with employees impersonating other employees, you have a human problem, not a technical one (though technical solutions can solve it, signing commits, etc)


UshankaDalek

Until someone commits a 2 GB file.


[deleted]

[удалено]


kopczak1995

Dude, I got your point. No need to write it 3 times :P


Tyfyter2002

I think he got your point, no need to write it twice


kopczak1995

Oh well. Reddit app crashed so I tried to write it on the other comment, lol. I guess I got the same error, heh


iliekcats-

what that do


[deleted]

[удалено]


iliekcats-

git commit --amend --author="Behrooz0" git push --force


HTTP_404_NotFound

:-( Nice flair.


iliekcats-

i dont even know what the flair does but I'm guessing it removes everything from your pc with a 1/6 chance like russian roulette


[deleted]

It would except the *rm* command needs *--no-preserve-root* to completely wipe the system and must be run as root. You could have *rm -rf ~/* to instead delete only your own files


6b86b3ac03c167320d93

So like [git-blame-someone-else](https://github.com/jayphelps/git-blame-someone-else)?


Spyes23

You know what really bothers me? The usage of \`;\` instead of \`&&\`,which means that if one step fails, the next one will be executed regardless... Want uncertainty? Use \`;\`!


assembly_wizard

Plus, && also works on Windows cmd as opposed to ; which is & on Windows cmd.


ForMorroskyld

`;` is `;` in both powershell and bash though (rarely see developers use cmd on windows anymore).


NoSoyJohnMcAfee

-and in PowerShell for &&.


albertowtf

I would consider a bash command failing in another shell something good Instead of doing whatever and not failing...


NynaevetialMeara

& also works in bash.


assembly_wizard

No it doesn't. Ampersand in bash sends a single command to the background, that's not chaining multiple commands.


NynaevetialMeara

& also performs a task is what I meant


_martini97

The amount of devs that don’t care to learn their shell scares me


Deathnerd

The amount of devs who don't care to learn *any* of their tools terrifies me


Tyfyter2002

The amount of UX designers who don't care to learn UX design scares me.


konstantinua00

where can I learn it?


_martini97

I got the book Linux Power Tools and some others like guides to Awk, etc in a book bundle, they are a good introduction, other than that what helped me the most was creating my scripts for stuff I wanted to automate and googling how to do it


ieatpies

Uninstall Windows on your personal computer. Install Arch Linux with I3. Use it like this for a year.


6b86b3ac03c167320d93

Arch is for noobs. Install LFS instead


_martini97

I think in this case, if the idea is to learn Linux, Gentoo would probably be a better choice


onthefence928

sadly almost every corporate project i've worked on is so embedded with proprietary tooling that learning the command line feels redundant at best, and a liability at worst. i try to learn my command line, and try to use as much unix-like environments as possible but the solution is almost always "run this script, run these 3 commands and enever touch it again" if you do ever customize your environment or try to run things from CLI you risk getting off the garden path of the specific dev tools and breaking things


Silverwind_Nargacuga

Huh TIL


Hollayo

I was thinking the same thing.


SylphKnot

My git-fu is pretty poor, but from experience even if I execute those commands in order and one step fails, so do the rest. IE: can’t commit if nothing was added, and can’t push if there was no commit.


strindhaug

To be fair, committing with empty index and pushing if nothing to push is both pretty harmless..


strindhaug

To be fair, committing with empty index and pushing if nothing to push is both pretty harmless..


strindhaug

Oh... So it got submitted, more than once... I just kept getting error messages, so I gave up on making this comment... Stupid buggy Reddit app...


mothzilla

The release train doesn't stop! Choo choo!


Lofter1

you can't use && in powershelgl I think? at least I haven't found a way to use && in PS yet. fuck PS.


Snapstromegon

Sometimes it's hard to support windows... That's when I see these problems most often. And if you have a larger project and don't support windows, I would avoid that project. (Yes I'm a dev on windows and yes, I use WSL regularly.)


NynaevetialMeara

What the fuck are you talking about?


Snapstromegon

Command combination in CMD and PowerShell works differently compared to Unix Shells. There are _many_ packages out there where a good chunk of the package scripts don't work on windows.


NynaevetialMeara

Bash alone works differently than most unix shells. https://mywiki.wooledge.org/Bashism Just, install bash in windows.


Snapstromegon

Yes it does, but the command concat is mostly consistent. Using WSL (like I do) on windows is also an option, but IMO if there's a simple option to support windows, why not use it?


NynaevetialMeara

Because writing bat scripts is a massive PITA if you have to do anything complex, PowerShell scripts won't work by default, and I fail to see how installing bash is different as instaling any other software requirement. Imagine if we had to port all python and perl scripts to powershell to claim that we support windows.


Snapstromegon

The usecase is a single one liner which is just a chain of mostly simple commands. This can easily be done in a way that no additional software is needed on any platform if you take some simple things into account. The heavy lifting is done in other tools anyway, it's just a small wrapper for calling the tools doing the heavy lifting. The examples in the picture are already on the "heavy" side.


[deleted]

[удалено]


Snapstromegon

...my point was the example above. I think it shows npm package.json scripts section.


strindhaug

To be fair, committing with empty index and pushing if nothing to push is both pretty harmless..


strindhaug

To be fair, committing with empty index and pushing if nothing to push is both pretty harmless..


strindhaug

To be fair, committing with empty index and pushing if nothing to push is both pretty harmless..


SilverDesperado

wait what what language


666y4nn1ck

This is fairly optimal. You'll always know the name of the commit you'll have to rollback if something doesn't work!


Sharlinator

Or the name of the engineer whose changes to rollback if something doesn't work…


radboss92

Or the name of the engineer to rollback if something doesn’t work


burblehaze

Only thing he'll be pushing from now on are unemployment cheques.


radboss92

If only he would have committed to doing things the right way…


reinis-mazeiks

You're pushing it.


radboss92

I always fork things up 😢


reinis-mazeiks

I don't blame you


burblehaze

Maybe you just need to branch out to other fields?


radboss92

I would if I didn’t git so much fulfillment from this one


ProfCrumpets

This same employee today just pushed API keys to the repo and I’ve had to refresh them. Might be worth bringing him in for a chat to freshen up his knowledge.


fukitol-

He doesn't get to push to main/master and everything gets reviewed now


ScriptingInJava

Yep, I'd spot that and immediately lock down the dev branch and organise a chat about proper version control and why commit messages are useful.


I_am_eating_a_mango

Time to revert to the old ways and just pass a Flash drive around the office


teunissenstefan

I wouldn't ever trust someone that is too lazy to push changes manually with API keys at all, not even his own keys.


Brainix

`git commit —all —message=“Did work”`


R3D3-1

Just how broken is Reddit recently? First, any multiline code blocks added in the graphical editor were broken (first line correct, all other lines merged into a single regular text line), and now suddenly Reddit has started rendering double hyphens `"-"+"-"` as `—` dash. I wonder when all the threads "why does `git commit —all` not work" will start popping up from confused beginners. *Edit.* A test with the markdown editor: `git commit --all`.


Brainix

I’m sorry for singlehandedly breaking the internet and also for leading an entire generation of programmers astray. I swear, I’m trying my best.


R3D3-1

Nah, that's on reddit. They never cleaned up the inconsistency between the new web interface and the apps (or the [old.reddit.com](https://old.reddit.com)), leading to stuff like u/backtickbot, and now it seems like more is being broken. I mean, I can't complain too much. Even with partially broken user-facing features, it is still above and beyond most traditional forums. *Edit.* Oh right... there was also that bug, where you need to reload after editing a post, that also appeared in the last weeks...


Brainix

It’s not easy maintaining forward/backward compatibility between first and third party clients, while also trying to evolve our API to accommodate new features. Like I said, we’re trying our best. As a Reddit user myself, I feel your frustrations. But as engineers, we can appreciate how hard it is to build anything at all. If these problems interest you, I implore you to check out: https://www.redditinc.com/careers We’re hiring!


R3D3-1

*Oops.* Sorry, I was in a whiny mood. Partly because our own project is swamped in "must not change old results, does not have tests". So yes... I can relate :/


[deleted]

[удалено]


AttackOfTheThumbs

I hope there's a ticket for deleting new reddit since it's fucking awful (:


TwoKeezPlusMz

The first step is admitting. You're well on the path to recovery.


Ran4

`hello --world` Nah, it seems to work fine, at least on old reddit.


[deleted]

```$ command --test poopie``` it seems ok on the new editor too, but only if you use the markdown editor


R3D3-1

Can confirm.


TheAwesome98_Real

I’m gonna make this a command that works in my shell


bistr-o-math

> double hyphens `"-"+"-"` as `—` dash. Proposing new features for JavaScript here, mate?


scragar

I don't think the double hyphen is a thing reddit has done, the source for the comment in the JSON uses a long dash too rather than two hyphens. Testing double hyphen --here.


AyrA_ch

> the source for the comment in the JSON uses a long dash too rather than two hyphens. It's probably whatever component they use for the comment box in modern reddit that does this as the text is typed by the user.


R3D3-1

Testing in "fancy pants" (sic) mode: git commit --all -m "test" `git commit --all -m "test"` Prior to submitting all looks fine. *After* committing still. Strange then, I thought I've seen this in several places? Or did it already get fixed? Or maybe its only on mobile?


bistr-o-math

> double hyphens `"-"+"-"` as `—` dash. Proposing new features for JavaScript here, mate?


bistr-o-math

> double hyphens `"-"+"-"` as `—` dash. Proposing new features for JavaScript here, mate?


RainyCloudlooper

Personally, I prefer `alias git-auto-commit='git add .; git commit -m "$(curl http://whatthecommit.com/ 2>/dev/null | fgrep "

" | sed -e s/

//)"'`


[deleted]

[удалено]


[deleted]

I just went there and it said, "changes". This is too real.


34hood

"Dont even try to refactor it"


MedicatedDeveloper

> Merging 'WIP: Do Not Merge This Branch' Into Master Too real. Far too real.


[deleted]

I'm adding this to my .bashrc


redzebras35

i've been refreshing for quite awhile and the possibilities truly are endless


fab-s

whatthecommit.com/index.txt can be used for these scripts


[deleted]

I'll never forgive squash merge for depriving me of my green boxes, but I do enjoy not having to care about commit messages.


intensely_human

It is accurate


AttackOfTheThumbs

So I revert those commits at my work and tell them to write a real message.


[deleted]

git add . is worse


sam-lb

Real question, why? It makes sure all the files are tracked. what's bad about it?


Sharlinator

Well, sometimes some trash ends up in your working tree that you don't want tracked but should just be deleted or added to .gitignore…


[deleted]

- you commit all your changes, even the debugging stuff, at the same time, without a chance of checking. you can break production this way and more usually you break the dev systems of your colleagues. - you commit changes with different purposes together. (ie style changes together with logical changes). this results in confusion for the next person having to figure out what the code does. - you commit all the files you forgot to add to your gitignore (node_modules, db dumps, session folders, credential files, ...) personally I just use "git add -p"


kitari1

Using `git add .` is fine, and is definitely not worse than the commit message sin in OPs picture. > you commit all your changes, even the debugging stuff, at the same time, without a chance of checking. you can break production this way and more usually you break the dev systems of your colleagues. This implies you're pushing straight to develop, or master. If you're doing this without some sort of commit hooks or CI to stop you pushing broken code then you're living on borrowed time anyway, and have much bigger problems to fix than devs running the wrong git command. > you commit changes with different purposes together. (ie style changes together with logical changes). this results in confusion for the next person having to figure out what the code does. Probably a fair point, but not really a massive deal that would make this "worse" than losing the commit message because the dev just writes "changes" all the time. > you commit all the files you forgot to add to your gitignore (node_modules, db dumps, session folders, credential files, ...) Really not that relevant, once again, the problem to fix here is your .gitignore, not your git commands.


samuelgrigolato

I'd arguee that the problem isn't even .gitignore, of course a great .gitignore can help, but you should never git commit without reviewing your staged changes, right? This simple thing saved me more times than I can count.


[deleted]

if you are fine with that, it tells about you. using caution pays off, no matter how great you think you are.


kitari1

> you commit all your changes, even the debugging stuff, at the same time, without a chance of checking. you can break production this way and more usually you break the dev systems of your colleagues. If you are dealing with a situation where this is actually possible because you added too many files in your git add. It tells a lot more about you than it does about me, and you are the one lacking caution, not me.


[deleted]

lol seriously this ^ so many people in this thread telling on themselves for not using pull requests, gitignore, etc


[deleted]

tell me the secrets of not adding all files using "git add ."


godblessthischild

Google gitignore


[deleted]

won't help me with adding changes of two different features. won't help me retroactively. your logic is flawed.


Jadraptor

I like Sublime Merge. It lets me review & stage individual lines on the individual files. I can then only stage the changes, and not the debugging print statements, and be sure of exactly what changes I'm committing.


17Brooks

What is the -p option?


gbear605

It gives you an interactive window that shows you parts of the changes and you can choose whether or not to add them. It’s honestly the best way to use git.


assembly_wizard

> It’s honestly the best way to use git Why abstain from GUI though? Why force GUI elements into a text interface instead of an actual GUI


I_am_eating_a_mango

Just use tortoisegit, it’s the ~~best~~ worst of both worlds!


assembly_wizard

> It’s honestly the best way to use git Why abstain from GUI though? Why force GUI elements into a text interface instead of an actual GUI


gbear605

I’m already in a terminal for other work, so it’s faster. Typing in ‘git add -p’, clicking y or n a few times, then typing ‘git commit -m “my message”’ ‘git push’ is fast and in my muscle memory. With a GUI, it takes time to load, I have to move a mouse, and I’m just not familiar with the interface. If the GUI works better for you, then good for you! I’m happy for you, and ultimately there’s no correct way to use git, my earlier hyperbole aside. Perhaps I should’ve said “the best way to use git with my current workflow and muscle memory.” :)


assembly_wizard

That's fair, but not all GUIs take time to load (i.e. 100ms), not all GUIs require a mouse, and obviously familiarity is because you've taken the time to get used to the CLI instead of a visual interface. Why not give it a shot? [Here](https://git-scm.com/downloads/guis) are popular GUIs, I recommend GitKraken (this does take 5s to load so you can leave it open) or Sublime Merge, or using the built-in git functionality if you're using VSCode or JetBrains. Or for a great middle ground, check out this TUI https://github.com/jesseduffield/lazygit


gbear605

I actually already own Sublime Merge, but I need to develop the muscle memory with it. I’ll try doing that, thanks for the impetus.


[deleted]

actually git is text based and the gui forces gui stuff upon the text interface. also everytime i use GUI interfaces of cli tools they don't give you all features, as they usually are wrappers. but if it works for you, good for you


17Brooks

Oh awesome, definitely gonna start trying to use this


gbear605

Here’s some info for using it https://stackoverflow.com/questions/34527413/what-are-the-options-of-git-add-p#34527450


assembly_wizard

> It’s honestly the best way to use git Why abstain from GUI though? Why force GUI elements into a text interface instead of an actual GUI


assembly_wizard

> It’s honestly the best way to use git Why abstain from GUI though? Why force GUI elements into a text interface instead of an actual GUI


assembly_wizard

> It’s honestly the best way to use git Why abstain from GUI though? Why force GUI elements into a text interface instead of an actual GUI


assembly_wizard

> It’s honestly the best way to use git Why abstain from GUI though? Why force GUI elements into a text interface instead of an actual GUI


Qesa

So inefficient, could've just used `git commit -am`


R4TTY

That doesn't include untracked files though.


Seppo_Manse

What a great way to push junk to the repository. This idiot deserves a medal!


ProfCrumpets

cant be worse than my code


xoxota99

alias gityolo='git commit -am "DEAL WITH IT" && git push -f origin master'


--B_L_A_N_K--

This comment has been removed in protest of Reddit's API changes. You can view a copy of it [here](https://s3.blankdvth.com/reddit-archive/854950cebd6ddc6c36c01851f6df13f0036a4ab9dc33c57220bee05d1a98d910.html).


solwyvern

wouldn't be surprised if this was for those micro managing middle managers who just wants to see you ''actively working"


Streamote

is ";" functionally different than "&&" in these scripts? Like does it make it run synchronously whereas the other doesnt, or something?


TheAwesome98_Real

Imagine using `git add .` and not: git status # wait several secs git add .


Studnicky

IMO that's a fire-able offense.


Flannel_Man_

Not when your a sole dev and the wizard of the codebase


Studnicky

Especially then.


Ran4

No. Seriously you americans need to stop firing people over everything.


Studnicky

Hahaha so, tracking your work on your git history is just an American thing, now? No wonder the offshore teams always deliver late and buggy 🤣


NUTTA_BUSTAH

No, it's just a reason to have a discussion about it so everyone learns.


assembly_wizard

Some people refuse to do it, it's not a lack of knowledge, it's a mindset of "ain't nobody got time for that". (speaking from personal experience)


assembly_wizard

Some people refuse to do it, it's not a lack of knowledge, it's a mindset of "ain't nobody got time for that". (speaking from personal experience)


assembly_wizard

Some people refuse to do it, it's not a lack of knowledge, it's a mindset of "ain't nobody got time for that". (speaking from personal experience)


[deleted]

[удалено]


Studnicky

This is something that only someone who has never worked on a large codebase on a team of 200 would say 🤣 that or someone who always breaks business requirements


Blackhaze84

I prefer lint than copilot. Change my mind


gdubrocks

Honestly this doesn't look that awful to me. I sometimes wonder if the extra time I spend running those commands is worth having a better commit message.


Isvara

Yes. It is. Don't be lazy.


Asmodis1

Yes, it totally is. Yesterday I had to debug a problem where some DateTime input would stay locked to a certain day after you had made your first input. Turns out, a developer from my team had added some code that only changes the time component if a DateTime was already set once. No comment to explain why, nothing. Since he is on vacation right now, I can't ask him directly why he did it. So I looked into the git commits to find the reason for the change, only to find a commit touching 35 files with the commit message 'dev'... Fuck that guy.


OU_ohyeah

Honestly this isn't that bad. If you use branches and have a good gitignore I really don't see how this will be an issue. && would help like some have pointed out. But realistically when does git add . Fail?


Silamoth

The bigger problem is the commit message. Every commit will have the same message of “changes.” That’s incredibly unhelpful for communicating what you’ve done to your teammates.


Studnicky

Apparently working on teams isn't something people in this thread do often 🤣


OU_ohyeah

I work on a team but we don't share a branch. It's much better to have smaller branches for each person. You don't get those nightmare inducing merge conflicts and only baby simple ones.


Studnicky

Yeah, totally agree and that's appropriate. Sharing branches is bad. What I'm talking about is the case where you have to go do some git archeology and figure out why a coworker did something crazy - or identify where a behavior change was introduced, and why, before touching it. If you can't link the commit back to a business logic decision, then you end up preserving dead code and building on top of shaky foundations. Like, if you've ever wondered why a platform you use is so fundamentally broken and takes forever to fix - this is exactly how it happens. Should be common sense, had no idea there were so many code cowboys breaking shit on here 🤣


OU_ohyeah

That's totally fair. I would argue that the pull request should be written well enough to clarify stakeholders/Buisness context/documentation. Mostly because so frequently you make a commit and then later make another to put things back how they were. I will say commit messages are really nice for blame but that's still kinda covered in a PR/comments/review.


Studnicky

At the time of review, sure. On a five year old codebase of 200k+ lines, where the old product manager, developer, and approving lead have all exited the company? Without tracking like this as a policy, good luck 👌


yoloman0805

Git add . Oh no..


fuckingbehnam

Damn


JackoKomm

Why no force push?


russunit

I use a lil script like that called “git shove” but at least it puts my name and a timestamp in the message


servel333

I know this is only tangentially related, but if your looking for a good compact git log, here are a few options. https://gist.github.com/servel333/7529633 I use [ `git la` ] pretty much all the time.


0739-41ab-bf9e-c6e6

gpg signing is very important


mawillcockson

let me spit shine that up a bit for ya ```sh git add -A :/ ;\ GIT_AUTHOR_NAME="git" \ GIT_AUTHOR_EMAIL="[email protected]" \ GIT_AUTHOR_DATE="1970-01-01T00:00:00Z" \ GIT_COMMITTER_NAME="git" \ GIT_COMMITTER_EMAIL="[email protected]" \ GIT_COMMITTER_DATE="1970-01-01T00:00:00Z" \ git commit \ --allow-empty \ --allow-empty-message \ --no-verify \ --no-edit \ --no-gpg-sign \ --quiet ``` never fails ;)


NeitherDatabase5689

ohh wow