this post was submitted on 04 Jul 2023
6 points (100.0% liked)

Linux

8095 readers
33 users here now

Welcome to c/linux!

Welcome to our thriving Linux community! Whether you're a seasoned Linux enthusiast or just starting your journey, we're excited to have you here. Explore, learn, and collaborate with like-minded individuals who share a passion for open-source software and the endless possibilities it offers. Together, let's dive into the world of Linux and embrace the power of freedom, customization, and innovation. Enjoy your stay and feel free to join the vibrant discussions that await you!

Rules:

  1. Stay on topic: Posts and discussions should be related to Linux, open source software, and related technologies.

  2. Be respectful: Treat fellow community members with respect and courtesy.

  3. Quality over quantity: Share informative and thought-provoking content.

  4. No spam or self-promotion: Avoid excessive self-promotion or spamming.

  5. No NSFW adult content

  6. Follow general lemmy guidelines.

founded 1 year ago
MODERATORS
 
  • How do i clone only "master" branch [ default protected branch? ] of repo?
  • what are the advantages & disadvantages?
  • how do i remove all other branches except master of forked repo?
all 5 comments
sorted by: hot top controversial new old
[–] [email protected] 2 points 1 year ago (1 children)

When you clone a repo only one branch is pulled from the remote, main by default so I don't understand your question. Cloning and forking are two different things. Clone is basically pulling a git project to your local computer where forking will create a copy of a repo (with all the branches) to another repo).

[–] [email protected] 1 points 1 year ago (1 children)

@shugzaurus

When you clone a repo only one branch is pulled from the remote, main by default

No. I havent read book recommended by @[email protected], but github cheatsheet $ git clone [url] says all branches https://training.github.com/downloads/github-git-cheat-sheet

[–] [email protected] 1 points 1 year ago

It downloads the branches meaning that it will download the list of the branches that exist, but only one branch is "checked out" at a time, which is where the files are actually downloaded to your pc.

[–] [email protected] 2 points 1 year ago

It’s important not to conflate git and github. Cloning is a git operation. Forking is a github operation.

I would recommend reading the excellent pro git book to understand how git works from the ground up: https://git-scm.com/book/en/v2

I’m not aware of a similar guide to learning github but I think it will be much easier to pick up once you have a better understanding of what git provides on its own.

Unless you need to interact with other people, you can always just clone the repo, work locally, and create your own github repo (without forking) to act as a remote and backup.