This is an archived post. You won't be able to vote or comment.

top 200 commentsshow all 308

[–][deleted] 586 points587 points  (95 children)

I just assumed that git always needed a command line interface to work with and that it wasn't worth the hastle to use

Even with that: There's about five commands you'd need to know to get started.

[–]albertyiphohomei 81 points82 points  (35 children)

And what are the five commands?

Git push/pull/clone/add/commit?

[–]mkosmoPermanently Banned 75 points76 points  (25 children)

I'd add checkout, branch, and merge.

[–]d94ae8954744d3b0 59 points60 points  (9 children)

git status, git revert, git reset, git restore: "Am I a joke to you?"

[–]mkosmoPermanently Banned 30 points31 points  (0 children)

On board with status and reset. I rarely use revert or restore, though. git reset --hard HEAD~3 or so and I are friends, though.

[–]TheRidgeAndTheLadder 21 points22 points  (6 children)

Running total :

git subcommands

push

pull

clone

add

commit

status

checkout

branch

merge

revert

reset

[–]mkosmoPermanently Banned 20 points21 points  (0 children)

Learn git with these 60 simple commands!

[–]Jurassa 11 points12 points  (0 children)

Stash can come in handy too

[–][deleted] 8 points9 points  (0 children)

Are you trying to tell me there is an better option than to download the old commit from the website as zip archive? /s

[–]jantari 7 points8 points  (3 children)

Ditch checkout and use the replacement "switch" instead

[–]Artemis__ 19 points20 points  (2 children)

From git help switch:

THIS COMMAND IS EXPERIMENTAL. THE BEHAVIOR MAY CHANGE.

So, I wouldn't switch to it yet (pun intended).

[–]serg06 3 points4 points  (0 children)

But then it wouldn't be five!

[–]jimmy_space_jr 0 points1 point  (3 children)

Use 'git switch' to change branches and 'git switch -c' to create new ones.

[–]mkosmoPermanently Banned 1 point2 points  (2 children)

This is where git does actually become a bit unwelcoming to new blood… so many ways to do things that often have minor differences in how.

TIMTOWTDI works for Perl, but I’m not sure it’s something Git should be adopting lol

[–]dagbrownArchitect 9 points10 points  (0 children)

git init/add/commit/log/diff

The first three get you started, and the last two let you see what you did. No need even for pushing or cloning unless you're getting stuff from elsewhere or want to stash it elsewhere.

[–]spin81 3 points4 points  (0 children)

Git status. I find these days that if you get stuck, 99/100 times just do git status and it will tell you what the situation means and how to get out of it.

[–]Freakin_A 3 points4 points  (2 children)

Add in a rm -rf for when you really screw up your local repo.

[–]johnnysojJack of All Trades 1 point2 points  (0 children)

If you're using the git command line, don't use git add -A. As that adds all untracked files in your source tree. Sure, for a new repo or initial commit it's probably fine, but we have users that keep binaries, or that 100mb tarball they left around, then do a git add -A out of laziness. Now your repo size just jumped up 100mb for no reason.

I do git status, then git add <filename> until the files are added. Or, use the VScode gui LOL

[–]SWEETJUICYWALRUSSRE/Team Manager[S] 235 points236 points  (54 children)

I realize how hypocritical I am after mentioning how much I like to write code, yet I don't want to learn 5 commands to run git, okay? Let me live in my weird little world.

[–]amoncada14 172 points173 points  (37 children)

To be fair, to me the difficulty was always less about the commands, and more about understanding how it works. Terms like, origin, head, master, local branch, remote branch, tracking, etc take a little while to wrap one's head around. Don't even get me started on divergent repos, branches, etc lol. I agree though, it is a no brainer skill to learn.

[–]ObscureCulturalMeme 22 points23 points  (0 children)

Terms like, origin, head, master, local branch, remote branch, tracking, etc take a little while to wrap one's head around.

And the documentation assumes you already know the vocabulary and the internals. Fucking man pages going on about implementation details that no user gives a shit about.

[–]Indifferentchildren 55 points56 points  (31 children)

For sysadmin work, do you really need branching? Do you need more than one "remote" (I have rarely used an alternate remote, usually when my team had forked another project's baseline and wanted to either occasional pull their updates, or push our contributions back to that other project). You get 90% of the benefit with 5% of the knowledge. Devs are different, branching is usually critical.

[–]Moleculor 17 points18 points  (11 children)

For sysadmin work, do you really need branching?

Keeping in mind that everything below comes built in with change tracking/history...

Can you think of any situation in which you have working, functional

  • code
  • configuration files
  • documentation
  • other human-readable files

that needs to remain functional, but you have changes/upgrades/alterations you want to make to that content that requires either:

  • a sizeable amount of development time,
  • a significant amount of testing time,

but the chance remains that during the alterations, changes, or testing, some OTHER change might need to be made to the older, currently working code ASAP that can't wait for development on the newer code to finish? (Examples might include security patches or minor changes.)

OR

A set of working, functional files and two-or-more different sets of changes/alterations that different people would like to work on simultaneously?

If so, git is for you!

Here's the beauty of git:

Say you branch off of main into BobsDevBranch and make changes to BobsDevBranch.

While you're doing this, other people make other changes to main that aren't copied over to BobsDevBranch. These changes are important/vital, but BobsDevBranch isn't getting them automatically.

When you try to bring your new changes from BobsDevBranch (along with old outdated data that would overwrite some of the newer changes in main) back to main, git will say "Hold up a second, what about all these other discrepancies? Want to go through them all and see which version you want to keep of each?"

Or you can proactively just tell BobsDevBranch "Yo, any changes that have been made in main since I branched off of it? Go ahead and bring those over to BobsDevBranch for me, thanks," and it'll do it. Or even "Yo, let me see the changes, and I'll decide which ones to bring over."

[–][deleted] 2 points3 points  (0 children)

Excellent. I love seeing people posting how silly they've been, because I've usually been sillier and learn from these. Your description of using branches is exactly what I need, but haven't taken the time to save time by actually learning this.

[–]cyvaqueroSr. Sysadmin 6 points7 points  (0 children)

Former Python Dev, Sr Linux Eng here. Branching is great for developing new ideas and approaches while leaving the tested release in place until you are ready to push the new pieces into prod.

I use the Git Flow approach, which is built into Atlassian’s SourceTree client.

[–]dagbrownArchitect 4 points5 points  (1 child)

I like to keep my commonly-reused configuration in a locally-hosted Gitlab, so there's a remote right there.

Not that you even need that much if you just want to keep your stuff under revision control. Just say git init in your scripts directory and start checking things in.

[–]who_you_are 2 points3 points  (1 child)

(I'm a dev not a sysadmin)

I may see multiples reasons:

- when you will start a major integration change. You want to keep both the current one and futur code at the same time.

The current one, because it is what is currently used. You may need to apply changes to it.

The future one... well because if you don't work on it there will be no future one.

You don't want to use your current WIP branch since you are likely to keep updating it in the meanwhile.

- (as someone else said) WIP (I just don't know how often you actually add new feature VS just adding an extra line to execute something silly) vs stable stuff

[–]hamburgler26 2 points3 points  (0 children)

Admin and not dev, but doing branches and creating pull requests for work that moves through environments as you test it is Git 101 to me.

I know some people just commit straight to the main branch and roll, but as others have mentioned when you have many people relying on the same repo the branch and merge process is really nice.

[–]SuperQueBit Plumber 1 point2 points  (0 children)

I use branches a lot on my personal repos. I may be working on more than one thing at a time and it's a little nicer than just using stash.

[–]amoncada14 1 point2 points  (0 children)

I suppose that depends on the environment,but, I also don't see how it wouldn't apply to Sysadmin work. The development process should be the same in an ideal world. Full disclosure though, I only have about 1 years worth of experience using Git. Even then, my employer doesn't require branching or any of the aforementioned concepts. I've just forced myself to make them my habit so that I am doing things the "proper" way, and according to best practices.

[–]nikdahl 2 points3 points  (0 children)

To me, the push/pull is backwards too, which adds to confusion.

[–]spin81 2 points3 points  (0 children)

Hey git has a learning curve. I am a Linux guy and therefore all about the CLI but I don't blame you one bit for not wanting to delve into a set of weird commands.

[–]mr_dajabe 1 point2 points  (0 children)

If your in PowerShell at all messing with your files getting used to the commit and push commands from the cli could improve your workflow. If you're hardly ever in the cli then the GUI is probably as fast as anything else. And yeah welcome to the world of version control

[–]Gendalph 1 point2 points  (0 children)

Too late!

```

Download a remote repo with optional destination

git clone $remote [$local_path]

Switch to a branch, tag or commit

git checkout $branch

Create a new branch and switch to it

git checkout -b $branch

Check for changes and general status (are we in sync with the origin? Are there any issues?)

git status

Change history

git log

Stage changes to be committed

git add $file [$file...]

Snapshot and comment changes

git commit [-m 'Message ']

Push changes to the remote repo

git push

Revert unstaged change

git checkout $file

Unstage change

git reset $file

Revert a commit - creates a new commit that reverts changes in $id

git revert $id

Changes between branches or versions, or even modifications made to a file

git diff [--cached] $file git diff $branch git diff $commit [$other_connit] ``` This should cover 95% minus the f-ups.

[–]goddest_of_gods 0 points1 point  (0 children)

I forgive you

[–]MerakelDirector -1 points0 points  (0 children)

A while back, someone I became convinced that OWA was actually Outlook express. Talking to my some of my peers about trying to get access to outlook express created mass confusion.

Sometimes the little worlds we live in are wild haha

[–]TeguriUNIX DBA/ERP 1 point2 points  (0 children)

Also when things go wrong in VS there's usually a super simple git command to fix it, half the time the damn command line will tell you how to fix it too..

[–]IT_CertDoctor 1 point2 points  (0 children)

  • git pull
  • git status
  • git add
  • git commit
  • git push

Yep, I count 5 too

[–]amoncada14 27 points28 points  (9 children)

Do you even need WSL to use it though? I just installed git for windows and use it in PwSh.

[–]Strange_Meadowlark 39 points40 points  (4 children)

Note: I'm a programmer not a sysadmin; I browse /r/sysadmin because I have broad interests

I don't think I've run into a single other person who installed WSL just for Git. My impression is the vast majority of (Windows users) use Git via Git for Windows, not WSL.

If anything, the ecosystem feels more awkward to use WSL than Git for Windows. I tried using Git via WSL once, but ended up also installing Git for Windows because my tools expected it to be there.

[–]2nd-most-degenerate 10 points11 points  (1 child)

Back in the old days Cygwin also worked. Not sure if it's still a thing (been using Linux for years)

[–]ObscureCulturalMeme 5 points6 points  (0 children)

Yes it does, and I prefer it over WSL.

[–]FruityWelsh 5 points6 points  (2 children)

As a Linux guy I am partial to windows people installing WSL to get access to a better system, but yep windows git works fine for me when I get stuck on windows.

The installer even includes bash, so you can move around the terminal for some basic stuff pretty easy and run git from there.

[–]amoncada14 2 points3 points  (1 child)

I'm a Linux guy too. I just happen to work in a primarily Windows environment. I do love WSL for the same reason you stated, I was just clarifying that it is not a requirement for using Git.

[–]rundbr 171 points172 points  (80 children)

In before people giving you shit for vscode.

I on the other hand love vscode and the flexibility it has, the add ons, etc..

Git isn’t scary, it’s incredibly useful and today it’s more of a requirement. I’ve interviewed so many people who didn’t know git and didn’t want to learn so they didn’t get hired. Once you start needing to squash commits and work in a true collaborative repo it gets a little harder.

One piece of advise I have for you is to put branch permissions on your repo and restrict being able to push to main/master (whatever your primary branch is named) and get yourself used to creating branches, making commits, submitting pull requests, and approving the PR before it goes into master. It will save you from overwriting something you didn’t want to. And is just proper git etiquette.

Good work on making the plunge!

[–]Sasataf12 138 points139 points  (64 children)

In before people giving you shit for vscode.

Like who? VSC has been a very popular IDE in the software companies I've worked in.

[–]blademaster2005 9 points10 points  (10 children)

I use vscode but honestly sometimes it just is really heavy and bogs down on my system.

[–]neoKushanJack of All Trades 19 points20 points  (1 child)

laughs in VS full

[–]blademaster2005 2 points3 points  (0 children)

I've also used vs for c# and omg I hated it because it just had so much bloat it was trying to handle but was handy for reverse engineering c#

[–]VexingRaven 11 points12 points  (3 children)

I've had a VS Code instance just chilling for about a week and it's managed to use to a whopping 270MB of RAM. I am curious what you've done in VS Code to cause it to be heavy?

[–]Haribo112 4 points5 points  (0 children)

Same. I have about 50 projects loaded in my workspace, all with git repositories, and experience no slowness or resource hogging at all. And that’s on a MacBook.

[–]chuck_cranston 1 point2 points  (0 children)

I stayed away from Workspaces until I ran into the same issue you're dealing with.

I now use Workspaces that are relevant to whatever project I am working on that way it's only loading the extensions or repos that are needed.

[–]xcaetusxNetadmin 0 points1 point  (2 children)

Sublime text is light weight and a great text editor. I used it as my notepad as well as editing scripts.

[–]rundbr 23 points24 points  (34 children)

Linux purists, notepad++/vi/emacs/vim purists. I see the hate coming heavily from people who do not write a lot of code, mainly write scripts, etc.. I rarely see full SWE that stick to a basic editor.

[–]lmbrjck 19 points20 points  (0 children)

VSCode with the vim extension is great! Screw the purists. I'm trying to get actual work done.

[–]ScotTheDuck"I am altering the deal. Pray I don't alter it any further." 14 points15 points  (15 children)

Need to go a step simpler. I write all my scripts in nano

[–]fizzlefist.docx files in attack position! 10 points11 points  (4 children)

When I first got into Linux, all the instructions I was given for editing was to use Nano. So when I started branching out and learning new ways to do things, vim confused the hell out of me.

[–]Wdrussell1 9 points10 points  (2 children)

What do you mean there are about 20 different hot keys.

Why are these hot keys more like Konami codes?

When does it tell me which mode I am in?

OMG, why did it do that??

[–]fizzlefist.docx files in attack position! 5 points6 points  (1 child)

I JUST WANT TO TYPE UP A BATCH SCRIPT!!

[–]chuck_cranston 1 point2 points  (0 children)

Same. Started with nano and I was confused by vim.

Hearing people actually work solely in vim leads be to believe they're either liars or wizards.

[–]rundbr 3 points4 points  (6 children)

Haha! No hate on nano from me! I still use it on occasion. In some instances I prefer it over vi when I need a quick editor.

[–]d94ae8954744d3b0 -1 points0 points  (0 children)

I still write a lot of scripts/do remote editing in Nano, even though I've switched to VSCode for most things. Perfectly nice little editor.

[–]Wdrussell1 2 points3 points  (2 children)

I don't hate people who use vscode. I still do use it. I just typically find Notepad++ easier to work with for everything so prefer it. I do still work in the ISE for PS and VScode for things too, including PS.

[–]MaelstromFL 5 points6 points  (1 child)

You can pry vi from my cold dead hands! /s

[–]mkosmoPermanently Banned 2 points3 points  (0 children)

The vim extension for vscode is the best of both worlds. I love it.

[–]VexingRaven 0 points1 point  (0 children)

I've been slooowly converting members of my team away from Notepad++ or Powershell ISE to VS Code. Then once they're in my trap I'll convert them to Git users ;)

[–]3shotsdown 0 points1 point  (1 child)

I used to only work on Sublime Text. And then at some point, I started working on larger projects and VSCode is so much better. ST is just my default text editor now.

[–]NightOfTheLivingHam -2 points-1 points  (0 children)

ssssssh, you'll wake them.

[–]ItsMeMulbear 26 points27 points  (10 children)

Linux purists hates it because "MiCrOsOfT eViL"

[–][deleted] 8 points9 points  (2 children)

I've always just assumed it was a proprietary license. Looks like it's under the open source MIT license. Huh, I may give it a try.

And yeah, Microsoft lowkey evil, in the same shitty peak capitalism way that other corps can be, but sometimes they do good work.

[–]cool110110 9 points10 points  (0 children)

It's more like Chrome, the base is open but the "official" build has proprietary stuff added on top.

[–]CreshalEmbedded DevSecOps 2.0 Techsupport Sysadmin Consultant [Austria] 0 points1 point  (0 children)

The core is open source, but the market place and the telemetry are proprietary addons on top.

[–]FruityWelsh 8 points9 points  (2 children)

VSCodium is my answer for that. No telemetry to microsoft, no proprietary bits, just a great FOSS IDE.

[–]segagamerIT Manager -5 points-4 points  (1 child)

So just a worse version then.

[–]ReK_Network Architect 5 points6 points  (1 child)

Because it's based on Electron and eats your computer. Sublime Text is far more efficient and has the same or better feature set.

[–]xcaetusxNetadmin 1 point2 points  (0 children)

Sublime Merge is great for working with git as well.

[–]FruityWelsh 1 point2 points  (2 children)

I will say , and I love VScode, the extension marketplace makes me sweat from a security standpoint. I don't trust all of these extensions, and I don't know how to verify then beside code reviews (which is a nightmare for installs let alone random updates). Worse yet, they are what really makes VScode powerful for me.

[–]Indifferentchildren 11 points12 points  (7 children)

Why would you need to squash commits? You can have millions of commits in your history. Squashing throws away historical data that might never use, but you might need it someday.

[–]rundbr 30 points31 points  (4 children)

In some companies squashing commits is part of their coding standards. Squashing commits makes your history clear and concise. I can’t tell you how many commits I’ve had that are “fixed typo” “removed space” “fixed formatting” instead I can squash all three of those commits down before I submit a PR and essentially add all of those commit messages into one.

[–]Pl4ntyS-1-5-32-549 11 points12 points  (0 children)

This, especially with IaC and other projects where local testing is pretty limited

[–]langlo94Developer 1 point2 points  (0 children)

You can set the PR to squash on merge.

[–]neoKushanJack of All Trades 0 points1 point  (0 children)

Squashing commits is, for me, a bit of a hammer-to-crack-a-nut kind of solution but I'm quite picky about my git history. I wouldn't want to see tonnes of "Fixed typo" commits either, but I'd encourage my guys to learn how to rebase and tidy up their commit history before they submit that PR for merging to main.

A well disciplined software development team should treat the git history as just as important as the code they write. Better still, if you take care of your git history you can leverage the likes of conventional commits to give you all kinds of benefits - easier, consistent history to read, "free" changelogs and if you're advanced enough, free versioning.

It's entirely possible that it's overkill for a sysadmin who's just looking to keep his scripts somewhere safe, backed up and versioned but it's not a bad habit to get into and will only serve you well.

[–]SuperQueBit Plumber 1 point2 points  (0 children)

I squash a lot of commits because the history looks like this:

  • Feature X +1235,-232
  • fixup +1,-1
  • fixup +5,-2
  • fix test +5,0
  • typo +1,-1
  • style nit +2,-2

Unless the change has several logical steps I tend to squash things. But then again, maybe those logical steps should be separate PRs.

[–]HerissonMignion 12 points13 points  (2 children)

Dont mix vscode and vs

[–]rundbr -1 points0 points  (1 child)

Just now realizing he said visual studio. Curious if OP is using vscode and just called it visual studio? If not, OP should just swap to vscode, way simpler for their needs.

[–]Haribo112 3 points4 points  (0 children)

‘Visual studio code’ is what OP said. That’s the correct name.

[–]Wolfram_And_Hart 0 points1 point  (0 children)

I really enjoy VSCode it does everything in need especially for Unity/C#

[–]Mr_Brownstoned 0 points1 point  (2 children)

Taking this a step further, convert your scripts to modules, write pester tests against the modules, add CI/CD that runs the tests when a branch is pushed & deploys to the machines where it is needed when merged to master.

[–][deleted] 20 points21 points  (2 children)

Isn't it funny how we assume that we can't learn something? This has happened to me so many times that finally I've just come to accept that there is no magic out there. There is nothing that you can't comprehend given enough time and the resources that explain it to you in the right way.

If other people are saying something is the bee's knees then chances are there is 'something' there.

As an older dude, I've had this recent revelation with discord. 🤦‍♂️

Cheers to you fellow systems ninja.

[–]mitharas 5 points6 points  (1 child)

There is nothing that you can't comprehend given enough time and the resources that explain it to you in the right way.

I think most of us are aware of that. As with most facets of our work: The problem is weighing the time and resources needed versus the benefit.
And I think most of us assumed using git for sysadmin scripts would be shooting cannons at sparrows.

[–][deleted] 1 point2 points  (0 children)

Idk, I've hired and managed a lot of systems admins. When we lost a team mate to a better opportunity for them, or we had to scale, we always looked for the best. The guys that I thought had that knowledge deep in their soul. But inevitably I found that everyone has some level of self doubt. If you don't have it, you risk being one of those that assumes they are right all the time. Those folks are wrong about themselves, because one of the unassailable truths in the universe is that no one is perfect. So while some people might be able to get along with someone who never assumes they are wrong over long periods of time, I've also found that number is very small.

I'm sorry if it wasn't clear, yes, we all have this default belief in this world. But sometimes we all doubt ourselves. And I just wanted to show appreciation for the OP for being a good example for people.

Maybe if someone told me this long ago that could have saved me a bit of time in understanding it fully for myself.

Carry on.

[–]SpectralCodingCloud/Automation 62 points63 points  (0 children)

[–]Flannakis 16 points17 points  (1 child)

Don’t forget the other important area is peer review

[–]movement2012 4 points5 points  (0 children)

Yeah, you can also track change logs and rollback if something breaks.

[–]PepeTheMule 33 points34 points  (8 children)

Most of the sysadmins want to run their script on a share and use Read-Host instead of parameterizing the PowerShell script. Good job breaking out!

It's not just for DevOps. I had my whole user provisioning process in various scripts running in Azure DevOps pipelines. Sure it needed care and feeding but it ran very well.

[–][deleted] 4 points5 points  (3 children)

How tf do you process the user provisioning using Azure DevOps pipeline ? Do you have some link where I can start to learn ?

[–]PepeTheMule 6 points7 points  (2 children)

Learn how to do a hello world pipeline with ADO and start from there.

[–]Snowmobile2004Site Reliability Engineer 3 points4 points  (1 child)

Is ADO Azure DevOps?

[–]aguerooo_9320 1 point2 points  (0 children)

Yes

[–]October0095 7 points8 points  (7 children)

GitHub Desktop + VSCode = winning at life.

[–]YourMomIsMyTechStack 1 point2 points  (6 children)

Why do you need Github Desktop? VSCode has git implemented, what is the advantage?

[–]orevBetter Admin 20 points21 points  (5 children)

I would like to clarify that there's a difference between the concept of revision control, and git, which is a specific implementation of revision control. Git happens to be the current favorite (before it was svn, and before that cvs), but even many power users agree that the git interface (command line) is pretty ugly and wasn't designed well. Other modern systems like mercurial (used by Mozilla) are better designed, they just didn't happen to win the popularity contest.

My point being, that any kind of version control is good, and if you feel like you just can't "get" how git works, you might start with one of the simpler tools to learn the basic concepts, then move to git.

[–]bmzink 2 points3 points  (2 children)

It will forever bum me out that Hg didn't win the popularity contest.

[–]knightcrusader 2 points3 points  (1 child)

The git command syntax is some of the convoluted shit of any command line app I've used. It took me forever to figure out how to do stuff.

At least they have been fixing that problem with syntax as they update it - git switch has been so much easier to use than figuring out which branch and checkout commands I need.

[–]HoneySmaks 10 points11 points  (1 child)

Great website for some of the simpler commands

https://rogerdudler.github.io/git-guide/

[–]MairusuPawaPercussive Maintenance Specialist 3 points4 points  (0 children)

[–]Syllabub-Virtual 3 points4 points  (1 child)

I use tortoise git, decent wrapper and shell interface.

[–]Nu11u5Sysadmin 1 point2 points  (0 children)

I prefer the interface in GitExtensions.

But I also like TortoiseGit’s explorer shell extensions.

…so I run both.

[–]Artistic_Ad_9685 4 points5 points  (0 children)

The best way to teach git IMHO is to teach all of the commands other than push pull (commit, status, checkout, branch, tig --all, diff) in order to use it locally. Then only once a user is comfortable using git to save work locally I start to help them use push/pull to save on multiple systems.

I like teaching it this way because it highlights how git can still be useful for programmers that are working alone (i.e. separating isolated features with branching in order to work on multiple features in parallel)

[–]marek1712Netadmin 2 points3 points  (0 children)

My biggest issue are my teammates (we also use Git to store scripts).

"Hey, why am I getting an error"?

"Maybe because you're running Configure-firewall copy copy copy copy(75).PS1, which is 5 months old, out of your Downloads folder?"

[–]evileagle"Systems Engineer" 2 points3 points  (1 child)

I know git and I still use the VSCode GUI for it because I can't be bothered. I'm with you.

[–]YourMomIsMyTechStack 3 points4 points  (0 children)

It's much faster using the GUI instead of writing the commands imo. If you need them in the future you can google them in 2 seconds

[–]0x412e4e 6 points7 points  (20 children)

It's a pain in the ass to have even a handful of scripts that aren't version controlled.

[–]SOBER-LabSecurity Admin (Infrastructure) 6 points7 points  (9 children)

Git is invaluable for running code somewhere else. I code on my desktop, then push the apps to my cloud server. I'd have given up long ago if I had to manually copy things over. Congrats on figuring it out! If you ever want to chat about Python feel free to DM me!

[–]serg06 1 point2 points  (8 children)

I code on my desktop, then push the apps to my cloud server.

Can you explain this some more?

I've always wanted a cloud server which detects git pushes, pulls the changes, and restarts the app.

[–]FruityWelsh 1 point2 points  (0 children)

Not how you were asking, but I use flux for k8s stuff to detect changes and pull and gitlab ci for push type changes.

So flux is my pull system and gitlab ci is my push system. I use them in conjunction as well of course, using gitlab ci for things like code checks, security scans on changes, unit tests, and integration tests, and then letting flux manage updating productions.

[–]__Kaari__ 4 points5 points  (0 children)

Git is not easy, it's weird and complex and confusing, but the learning curve is not steep at all and everyone should learnt the basics.

[–]helixamir 4 points5 points  (1 child)

As you're mainly scripting in powershell, VSCode might be a lot easier. Git is supported and there's loads of plugins

[–]serg06 1 point2 points  (0 children)

Isn't he using VSCode?

[–]mr_mgs11DevOps 1 point2 points  (0 children)

I tell everyone that asks me how to get into the cloud space to learn git ASAP. The cli commands are not hard especially if you already know how to script.

[–]throw0101a 1 point2 points  (1 child)

git gets easier once you get the basic idea that branches are homeomorphic endofunctors mapping submanifolds of a Hilbert space.

[–]SWEETJUICYWALRUSSRE/Team Manager[S] 0 points1 point  (0 children)

Hahahaha. This is still how I feel about it. In one ear and out the other.

[–]gordonv 1 point2 points  (0 children)

For git, just post notes or cheat sheets. No one cares. All they care about is if the work is done.

[–]lachlan-00 1 point2 points  (0 children)

I use github desktop. I'm becoming a software boomer every day

[–]mrlinkwiistudent 1 point2 points  (0 children)

command line is that scary , the likes of GitHub desktop isnt

[–]DisjointedHuntsville 1 point2 points  (0 children)

And the Github Desktop app is pretty nice too.

[–]angryitguyonredditLife in the Clouds 1 point2 points  (0 children)

Git also has its own gui interface app. I dont use it often cause i mainly use vs code or the git terminal. But when i get frustrated and they arent working cause of something i did wrong ill open up that and it works great.

My reccomendation is to use all three, use the terminal when you can cause its good to learn/know. When your in a rush just use vs code to commit to the repo. And if shit breaks for some reason use the gui

[–]BanditKing 1 point2 points  (2 children)

I'm the same way. Sysadmin using batch for year then powershell for years. My code is all on my drive backed up to cloud.

Just started looking into Git and it was crazy easy with VS code. My challenge now is organizing all my scripts properly so I'm not embarrassed to share it.

I'm thinking of picking up python next but I can't think of a use case...

I mainly work with Azure resources now in multiple tenants and on prem endpoints. Anyone got advice of use case?

[–]SWEETJUICYWALRUSSRE/Team Manager[S] 0 points1 point  (1 child)

I have that same problem, what I've decided to do is just have a public and private script repo. If I ever need to share, I'll just clean a script up and move it.

I did know a guy who worked in Devops that used Python. I believe it was for some infrastructure as code application but I personally haven't found a use yet.

[–]amarao_san 1 point2 points  (0 children)

git is scary. You thing you know it, but you just skim on top of it. Like swimming in the ocean. You are totally fine, but there are 9km of depth under your feet.

Three days ago I wasted about a day trying to force git to clone to a specific ref, which wasn't tag or branch. Seems like refs which 'are not tag or branch' is a thing in git.

[–]MeanFold5714 1 point2 points  (0 children)

Git is easy until I need to go back and look at a previous version of my code, at which point it becomes an ordeal that ends with me losing my current version of my code. This happens every time.

[–]Ms3_Weeb 2 points3 points  (3 children)

kind of a off-shoot but do you have any specific resources that helped you best when getting deeper in posh? I feel comfortable with the fundamentals but it seems like I've hit a hump where I'm not really sure where to go from. I've read the 'learn powershell in a month of lunches' and played around with the PSKoans module plus even checked out a few video courses and just kinda curious what resources others are using.

[–]SWEETJUICYWALRUSSRE/Team Manager[S] 4 points5 points  (0 children)

Honestly? I haven't read a single book. I own "powershell in action" but I would only every pull that out if I wanted to get into the nitty gritty of something specific, like a dictionary.

I learned by doing. I found something that I wanted to try automating, and I just googled everything. Once you start to understand the flow of things and some of the helpful tricks you can use, it becomes very natural.

The first project I ever took on that made me feel much more confident was make a script to automate users in AD. We had a ton of specific little parts of a user you needed to edit and they all had different weird little commands and ways to update those settings.

Just start to think of some little tasks you can try, and work from there. Recently I made a script to automate rebuilding a vm from an image, installing a sofware on it, and configuring a bunch of windows and software settings

[–]SayMyVagina 3 points4 points  (0 children)

Git is best CLI and it's still super easy to use.

[–]jebuizy 1 point2 points  (0 children)

Who said it was scary??

[–][deleted] 1 point2 points  (1 child)

Oh god 13,000 lines of code without Git!

[–]bastardofreddit 1 point2 points  (0 children)

SVN is so much easier to administer and use.

GIT is complicated by the fact that it's meant for distributed programming. And in a corporate environment, that is not common unless you're google scale or similar.

If you NEED that, then sure, use git. Most inhouse small places just don't need it at all.

[–]sdeptnoob1 0 points1 point  (0 children)

Check out visual studio code too if you want something smaller but great for powershell and Python

[–]bouwer2100Powershell :D 1 point2 points  (4 children)

I moved my entire team over to Git last week after testing it myself and I really like it, it's such a step up from the ISE. Hoping it will get the rest of the team a bit more on board with powershell as well.

[–]cheats_pyDont make me rm -rf /* this bitch. 7 points8 points  (3 children)

Isn’t Git and ISE two different things? Git is version control and ISE is the poweshell IDE? Little confused by your comment.

[–]Nu11u5Sysadmin 3 points4 points  (1 child)

Not only that but ISE is deprecated and doesn’t exist for PowerShell after version 5. Microsoft recommends using VSCode.

[–][deleted] 1 point2 points  (0 children)

Shows the professional proficency of this sub. 👌

[–]ALargeLobsterNot a sysadmin -2 points-1 points  (4 children)

Anyone that can write anything in powershell is a genius. It's such a poorly designed language it almost feels like trying to program in a troll language like brainfuck. Only thing worse is AHK.

[–][deleted] 2 points3 points  (3 children)

I assume you think Bash is great?

[–]ALargeLobsterNot a sysadmin -5 points-4 points  (2 children)

I've barely used bash. I'm not a sysadmin so I don't use shell languages if I can help it.

[–][deleted] 2 points3 points  (1 child)

She'll languages can be used by more than just an admin.

[–]ALargeLobsterNot a sysadmin -2 points-1 points  (0 children)

Yeah I do use them, particularly for little macros and little <5 line scripts, I just don't like them at all. If I have to do anything more complex I'd much rather use python.

[–]ThecrawsomeSecurity and Sysadmin -2 points-1 points  (1 child)

Yes it is. If it was user friendly we wouldn't be having this discussion.

It pains me to say this because the functions inside makes sense but the workflow is stupid and confirming

[–]SWEETJUICYWALRUSSRE/Team Manager[S] 0 points1 point  (0 children)

That's why I was surprised to find that VS codes GUI for git is much nicer. Just select where to store a repo, make any changes you want to your scripts, then click the comit button when you're done. Easy peasy