backhdlp, (edited )
@backhdlp@lemmy.blahaj.zone avatar

I don’t understand git anyway

fckreddit,

Well, you learn four commands and hope for the best.

Valmond,

fetch, reset --hard, checkout -b and cherry-pick?

:-D

muix, (edited )

More like clone, pull, commit, and push --force

>:-D

Valmond,

push origin head

^^

xmunk,

Nah, rebase -i, squash, fsck and reflog

Valmond,

reflog saved my life once after a stupid misshap.

All rebase are belong to us (onto, rebase, and ofc interactive) but what’s fsck (I don’t squash personally)?

xmunk,

Fsck is File System Check - realistically you should never need to use it.

rikudou, (edited )
@rikudou@lemmings.world avatar

Must be an interesting work if you never add, commit or push.

Edit: How the hell did you get the repo without clone?

xmunk,

Pshaw, real programmers write out the contents of .git by hand.

(Also, it was a joke, the last two commands I listed are ones you’ll ideally never need in your life)

overcast5348,

I was scared of reflog too. Had to use it for the first time recently after I accidentally’d a branch that I hadn’t pushed to remote yet. I was so glad that I could recover it all in <5 commands.

traches,

https://imgs.xkcd.com/comics/git_2x.png

Title text: If that doesn’t fix it, git.txt contains the phone number of a friend of mine who understands git. Just wait through a few minutes of ‘It’s really pretty simple, just think of branches as…’ and eventually you’ll learn the commands that will fix everything.

popcar2,
  • git pull
  • git add *
  • git commit -m “Some stuff”
  • git push

And occasionally when you mess up

  • git reflog
  • git reset HEAD@{n} (where n is where you wanna roll back to)

And occasionally if you mess up so hard you give up

  • git reset --hard origin/main

And there you go. You are now a master at using git. Try not to mess up.

SalsaGal,
@SalsaGal@programming.dev avatar

Neither, I’m a lazygit fan

hypnotic_nerd,
@hypnotic_nerd@programming.dev avatar

Yes, lazygit is fast as flash

Shinji_Ikari,
@Shinji_Ikari@hexbear.net avatar

I really never understood why one would need a GUI for git except for visualizing branches.

I feel like I’m crazy seeing so many people using clicky buttons for tracking files. I need like 4 commands for 95% of what I do and the rest you look up.

You’re already programming! Just learn the tool!

And now there’s a github CLI tool? I hate to beat a dead horse but Microsoft pushing their extended version of an open source tool/protocol is literally the second step of their mantra.

idiocracy,

knowing how to program doesn’t mean u need to do things the hard way.

heck the whole point of programming is to make things easier and faster.

popcar2,

FWIW not everyone using source control is a programmer. I’ve seen artists in game dev using GUI tools to pull new changes and push their assets.

Shinji_Ikari,
@Shinji_Ikari@hexbear.net avatar

That’s fair, there’s plenty of uses for source control.

I was speaking from a programming context though, as this is a programming community.

hubobes,

Maybe not a GUI but using a TUI (lazygit) I am certain that I can do everything faster than you could ever do using the CLI. Tbf if a GUI Tool had the same shortcuts it would also be faster.

sloppy_diffuser,

I use LazyGit on the CLI for a “GUI-like” experience. I find it helps me make smaller more meaningful commits. If I’m working on a feature that enhances or fixes other modules in my repo to support, its trivial when done to make multiple clean commits out of the one feature that isolates the changes in functionality to individual commits instead of one medium commit.

On a large enough repo (e.g., monorepo), its a pain to do using git commands.

coloredgrayscale,

Checking the diff before commit, solve merge conflicts

Also if it’s well integrated into the IDE it feels less like using a separate tool. For 95% of what I do the ide/gui feels better (fetch, pull, push, commit, checkout, merge). Usually just 2-4 clicks and no need to type the branch name (ticket number and then some)

For Reflog, reset I use the terminal.

If I had to start github desktop or another seperate gui I would use the terminal that’s integrated into the IDE.

OpenPassageways,

I primarily use GitHub CLI to interact with the GitHub API, not Git. I don’t really see it as an extension of the Git CLI, which I use much more frequently. Everything you can do with it can also be done through their REST API.

I use it for things that aren’t really git features, like:

Syncing repository admin, pull request, and branch control settings across multiple repositories

Checking the status of self-hosted actions runners

Creating pull requests, auto-approving them

Shinji_Ikari,
@Shinji_Ikari@hexbear.net avatar

Thanks for the explanation, that does sound useful.

firelizzard,
@firelizzard@programming.dev avatar

Do you use the command line for everything? Do you edit with vim, view diffs with git diff, browse the web with links or lynx?

GUIs are useful tools. I’m happy with VSCode’s git integration. It’s just what I need for basic stuff like staging files and committing. I use the CLI whenever I want to do something like rebasing because I can type that command faster than I can figure out the GUI, but it would be stupid to artificially force myself to use the CLI for everything because of some kind of principal.

Shinji_Ikari,
@Shinji_Ikari@hexbear.net avatar

Yeah I actually just prefer the command line, I’ve never had to force myself to use it. I even tried using VSC for a bit recently but i couldn’t get myself to like it. I just use nvim with some plugins in a tmux session now and its productive as hell.

Of course I don’t browse the web with the command line. For merging branches, I always merge main into the working branch first, check conflict files, and go through the file finding the diffs and resolving them. I’ve used merge tools before that were sorta nice but I had my own issues with them.

Maybe it’s the type of programming I do. I don’t do any web stuff, so file count is down. For larger code bases I keep a non editor terminal up and will grep -re for word/phrase searching, find to look for specific files, etc. I’ll occasionally use an IDE, typically eclipse based because embedded, but I don’t find myself missing the features they add.

firelizzard,
@firelizzard@programming.dev avatar

Of course I don’t browse the web with the command line.

That’s my point. Browsing the web with a command line tool is obnoxious - you use a GUI for tasks that you find easier/more pleasant to do with a GUI. The difference is where that line is. When I’m reviewing what work I’ve done and checking through my code for debugging statements and other cruft I don’t want to push, I prefer to have a nice tree view of my change set where I can click on an item, see what I’ve changed, select lines and stage them, select other lines and revert them, etc. I could do all of that with command line tools (though not that many have mouse support) but I already know how to do exactly what I want with VSC so why would I use anything else?

You’re already programming! Just learn the tool!

If someone is incapable of learning the tool, that’s an issue if they’re a developer. But your statement implies that everyone should use the CLI for everything. My point is that it’s a matter of preference. The CLI is not superior and GUIs aren’t superior. They’re both just tools and if you can get your job done quickly and efficiently, that’s all that should matter.

derpgon,

JetBrains IDEs, I don’t remember the last time I used the CLI.

CodingCarpenter,

I was looking for this comment. PHP storm and git are like best friends. I very very rarely need to resort to the CLI and generally that’s for hard resetting after I screw something up

expr,

Good luck doing anything remotely complicated/useful in git with an IDE. You get a small fraction of what git can do with a tool that allows absolutely 0 scripting and automation.

muddi, (edited )

There are automations. You can even add git hooks iirc. Mostly I find the lint and other code quality integrations nice to have in the IDE, since the inline results allow me to navigate directly to the code

Diffing is a lot easier too

derpgon,

It sounds like you don’t speak from experience. I have all the automation I need. It supports git hooks on top of IDE-only features like code checking.

If I have to fire up my CLI for some mass history rewriting (like changing an author for every commit), or when the repo breaks - so be it. But by not using the CLI I save my fingers and sanity, because committing a bunch of files is several click away with little to no room for error.

I can rebase, patch, drop, rename, merge, revert, cherry pick, and solve conflicts with a click of a button rather than remembering all the commands and whatnot.

GBU_28,

I use the cli, but my main goal is to never have to do anything remotely complicated with git. Does it happen sometimes? Of course.

eluvatar,

This is the way

caseyweederman,

you have forgotten the face of your father

QuazarOmega,

Linus Torvalds?

CCF_100,

Well one runs on Linux and the other doesn’t so…

snugglebutt,
@snugglebutt@lemmy.blahaj.zone avatar

They both do

CCF_100,

Oh really? Well, I stand corrected then, nevermind

criticalimpact, (edited )

CLI
Though I will admit it took me a while to get there
git add -i is where the true magic begins

stepanzak,

TIL!

FiskFisk33,

git log --graph --oneline --all

hakunawazo,

Also part of the Cli magic is a pretty git log tree like that:
https://lemmy.world/pictrs/image/3302d15a-1370-4f02-bc0d-5ec00c0c20f6.png
stackoverflow.com/questions/1838873/…/34467298#34…

And a proper diff tool like vim:

git config --global diff.tool vimdiff git config --global difftool.prompt false

(Current diff could be closed with :qa. All diffs could be closed with :cq).

lseif, (edited )

using LazyGit in tmux has changed my workflow.

instead of: git add . git commit -m ‘foo’ fg

i just: g ac foo q

and it displays everything neatly

Edit: apparently greater/less than symbols dont render properly on lemmy. so imagine a few (CR)'s and (C-b)'s sprinkled in

alphabetsheep,

Are you able to fall back to normal git commands if you don’t know the shortcuts? This sounds awesome until I can’t remember the syntax to do something I don’t do everyday.

lseif,

you can run shell commands with :, and there may be a nicer way for git-specific commands which i dont know about.

each ‘pane’ (such as ‘changed/staged files’, ‘commit log’, etc) has its own keybinds, which you can see with ?

MangoPenguin,
@MangoPenguin@lemmy.blahaj.zone avatar

I really like Sourcetree, been using that for a long time.

ohlaph,

Same here. Use it regularly at work. For personal projects, I tend to just use the IDE.

pimeys,

Magit

akkajdh999,

fugitive

RePierre,

I was looking for someone to mention Magit. It just rocks!

h_a_r_u_k_i,
@h_a_r_u_k_i@programming.dev avatar

This + org-mode are enough for me to switch to Emacs.

alphabetsheep,

Ohmyzsh with the git plugin is my fave - gaa &amp; gcmsg “a commit” feels like the right level of verbosity for me.

hypnotic_nerd,
@hypnotic_nerd@programming.dev avatar

Wow what’s the plugin name I wanna try it out.

alphabetsheep,

The plugin is just called “git” it comes with ohmyzsh out of the box. You just have to enable it in your zshrc.

hypnotic_nerd,
@hypnotic_nerd@programming.dev avatar

Thanks 👍

akkajdh999,

lazygit:

dukk,

Freaking love TUIs, it’s like they took the convenience of a GUI and the efficiency of the CLI and merged them. As a Neovim and Lazygit user myself it’s amazing what I can accomplish in but a few keypresses.

smeg,

I feel those captions are the wrong way round

xmunk,

There are much better git UIs out there.

smeg,

Definitely, last time I used github’s one it could barely do more than push and pull. I’ll almost always use a (good!) UI over the git CLI though.

expr,

No matter the GUI you use, you’re leaving a lot of useful functionality on the table. By their nature, you only get a small fraction of git’s features. There are many useful commands I use regularly that are impossible to replicate using GUIs.

smeg,

A good UI (for you personally) should do all the things you regularly do. Git is a complex and messy enough beast that when I have to use the CLI I’m going off the golden path and copy+pasting something arcane.

0ops,

It’s not like you lose access to the cli when you use a gui. I personally use both

TheFerrango,

Laughs in Sourcetree

nilloc,

Sourcetree best for free, thanks bit bucket.

Tower is pretty nice for mac user too. I paid for it for a few versions back when I was coding full time. Now I just stuck to source tree for occasional freelance and personal projects.

Juice, (edited )
@Juice@hexbear.net avatar

Uh how do i get GH cli to work on Linux? I tried pushing a project and it just asks for a password, and PW support is deprecated

Gambled23,

Use ssh authentication instead

aBundleOfFerrets,

key identification

stepanzak,

I’m not sure about the exact commands, but you do something like gh auth login to authenticate the CLI and then something like gh ssh setup to change ssh’s config file to authorize using the GH CLI.

Juice,
@Juice@hexbear.net avatar

I’ll try that, thanks

usa_suxxx, (edited )
@usa_suxxx@hexbear.net avatar
Juice,
@Juice@hexbear.net avatar

No luck, i tried that and https login and it still asks for a PW when I push

usa_suxxx, (edited )
@usa_suxxx@hexbear.net avatar

HTTPS

git remote add origin https://github.com/user/repo.git

SSH

git remote add origin git@github.com:user/repo.git

Did you use the correct syntax for SSH?

cupcakezealot,
@cupcakezealot@lemmy.blahaj.zone avatar
Aatube,
@Aatube@kbin.social avatar

Any windows screenshots?

(Fork is also an awful name in terms of searching for it btw)

cupcakezealot,
@cupcakezealot@lemmy.blahaj.zone avatar
caseyweederman,

You have my attention

Do they have a Linux client though?

cupcakezealot,
@cupcakezealot@lemmy.blahaj.zone avatar

sadly no and i don’t think it works through wine

but technically they have a mac client which is basically an expensive version of linux

Aatube,
@Aatube@kbin.social avatar

Not really. It’s BSD, and even then the layout of the OS is quite far from BSD. Besides that you have a lot more technical stuff. Just use wine.

eluvatar,

Been using it for years it’s great

  • All
  • Subscribed
  • Moderated
  • Favorites
  • programmer_humor@programming.dev
  • localhost
  • All magazines
  • Loading…
    Loading the web debug toolbar…
    Attempt #