• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Git - Practice Repository for Beginners?

 
Ranch Hand
Posts: 70
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Marco Behler,

Congrats on your new e-book:
Git: Merge, Cherry-Pick & Rebase

I've browsed downloaded and commented on Git, but I have never setup my own Repository.

Is there a "Practice Repository" where Git Newbies can learn by creating a test local or "dummy" repository and practice fork, merge, etc. ?

It would be nice to practice with something "private" to better learn the technology.

Thanks,

Geoff
 
Saloon Keeper
Posts: 15630
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not the author, but let me answer anyway. You can set up a local repository as easy as running "git init". That way you can play around with a folder that contains just dummy files.

Also, you shouldn't be afraid to clone a remote repository and then play around with it. A clone is a local copy of a remote repository, and as long as you don't push any changes, you're fine. However, it's not usually possible to push to a repository that you don't contribute to anyway.

Keep in mind that most git commands are non-destructive: They don't interfere with commits that have already been made. If they do, you usually have to supply a -f or --force option before they can run.

Finally, you can also practice Git a bit using this wonderful interactive tutorial: https://learngitbranching.js.org/
 
Author
Posts: 141
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can basically only second what Stephan said.

The most important part is this. Take any folder you want, put ONE file inside, aka "hello.txt", run "git init" and then you have a full-blown git repository that you can use to add/commit your file.

Especially if you want to get started with it/play with it, just take a folder with ONE file inside. It let's you practice literally everything that you'd want to practice, without being scared too much.

Hope that makes sense
Marco
 
Author
Posts: 37
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Geoff,

Git is a decentralized version control system. This, for an absolute beginner, is a huge advantage, b/c you don't need any setup to start working on Git. You don't need a server to serve up repositories, you don't need an admin to create branches yadi yadi yada. Like @Geoff and @Stephan already said, you can literally do



And boom! You have a fully functional Git repository. You can do almost everything right here—you don't need Github, or GitLab. The only piece you are missing out on is the "collaboration" piece, which, since you want something "private" doesn't matter at all.

There are tons of guides (text, video) that you can use to get some hands-on practice. And you should be able to follow all of them without ever leaving your machine. This is as private and safe as it can get.

To give you a sense of how I work, there are times when I am composing an email (say to a potential client) or writing a proposal—step 1—create a Git repository. Then put my files in that directory and manage my edits in there. That repository will never leave my machine! Once I am done composing the email or the proposal, I send it off, and then might just delete the folder!

Hope this helps. Feel free to reach out if you have any other questions.
 
Geoff McKay
Ranch Hand
Posts: 70
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks to Stephan, Marco and Raju for your helpful responses.

This is great to know.

Appreciate it!

Geoff
 
Saloon Keeper
Posts: 27885
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One of your best friends is the "git status" command.

Every file and directory in a git project is either in a modified or unmodified state and git tracks your modifications. Use git status to see what files have been modified since the last git commit. It will also tell you about files that aren't under git control (use git add to add them) or have been deleted.

When you are ready to preserve your changes, use git commit and the committed files will no longer list in git status.

Finally, you can use git diff to list the changes made to a file since its last commit.

That's pretty much the core set of features and commands. I've left out how to connect a git project to a remote repository, but that's for another day. As is how to revert changes.

---

Note: edited because I did such a sloppy job on markup.
 
Geoff McKay
Ranch Hand
Posts: 70
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:One of your best friends is the "git status" command.

Every file and directory in a git project is either in a modified or unmodified state and git tracks your modifications. Use git status[/i] to see what files have been modified since the last [tt]git commit[/i]. It will also tell you about files that aren't under git control (use [tt]git add to add them) or have been deleted.

When you are ready to preserve your changes, use git commit and the committed files will no longer list in git status.

Finally, you can use git diff to list the changes made to a file since its last commit.

That's pretty much the core set of features and commands. I've left out how to connect a git project to a remote repository, but that's for another day. As is how to revert changes.



Thanks Tim,

Appreciate your suggestions.

Geoff
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic