This document provides an overview of Git and GitHub for version control. It discusses why version control is useful, both for individuals and teams working on code. It then introduces Git and GitHub, covering basic Git commands, fundamentals of using GitHub, and how GitHub can be used for project implementation and collaboration. The document includes an agenda, explanations of key concepts, and links to GitHub documentation for setting up accounts and learning more commands.
Git Tutorial A Comprehensive Guide for Beginners.pdfuzair
flicts
If there are conflicts when merging changes, Git will prompt you to resolve them. You can use a variety of tools to resolve conflicts, including text editors and graphical merge tools.
Advanced Git Commands
git diff
The git diff command shows the differences between two different versions of a file:
phpCopy code
git diff <commit1> <commit2> <file>
git reset
The git reset command is used to reset the state of the repository to a specific commit:
perlCopy code
git reset <commit>
git stash
The git stash command is used to temporarily save changes that you are not yet ready to commit:
Copy code
git stash
Git Best Practices
Committing frequently
It is important to commit your changes frequently, rather than waiting until you have completed a large amount of work. This makes it easier to track changes and identify problems.
Writing meaningful commit messages
Your commit messages should be descriptive and provide context for the changes that you have made.
Creating descriptive branch names
Your branch names should be descriptive and provide context for the changes that you are working on.
Conclusion
In this guide, we have covered the basic concepts of Git, how to install it, and the
Git can be a complex tool, but with practice and experience, you will become more comfortable using it. If you have any questions or run into any issues, there is a wealth of resources available online, including documentation, forums, and tutorials.
Thank you for reading this comprehensive guide to Git for beginners.
FAQ
It provides a number of benefits, including the ability to collaborate with others, maintain a history of your code, and easily revert changes if necessary.
What is a repository in Git? A repository is a central location where your code is stored and managed. It contains all of the files and directories that make up your project, as well as a history of changes made to those files.
What is branching in Git? Branching is the process of creating a new line of development for your code. It allows you to work on new features or changes without affecting the main branch of your code.
How do I resolve merge conflicts in Git? When merging changes from one branch into another, you may encounter conflicts between different versions of the same file. Git provides tools to help you resolve these conflicts, including text editors and graphical meflicts
If there are conflicts when merging changes, Git will prompt you to resolve them. You can use a variety of tools to resolve conflicts, including text editors and graphical merge tools.
Advanced Git Commands
git diff
The git diff command shows the differences between two different versions of a file:
phpCopy code
git diff <commit1> <commit2> <file>
git reset
The git reset command is used to reset the state of the repository to a specific commit:
perlCopy code
git reset <commit>
git stash
The git stash command is used to temporarily save changes that you are not yet ready to commit:
Copy code
git sta
With these slides we introduce the concept of source control and teach the core features to using Git, GitHub and BitBucket. You can find the accompanying video here. https://youtu.be/lZpNrCgGvuI
At the end of this session, you will be able to:
* Install git
* Create a local git repository
* Add a file to the repo
* Add a file to staging
* Create a commit
* Create a new branch
* Create a GitHub repo
* Push a branch to GitHub
In this project, you will learn to use some of the team” features o.docxbreaksdayle
In this project, you will learn to use some of the “team” features of your preferred IDE (Eclipse or NetBeans). We will use the “Git” source code control system to allow all members of the class to work on the same project at the same time, and then to merge in your changes. This is a “real-world” way of working on code; few developers work on real projects by themselves. (And even then, version control is often useful and used.)
The project is a very simple one. The source file SayHello.java has a main method you need to edit. Add a statement to main to greet the class by displaying a unique string (so your contribution differs from other students'), which should include your name. (You are free to add additional output if you desire, such as a quote or joke.)
I have created a Git repository you can access from the
GitHub.com
. This repository contains the initial version of
SayHello.java
, a
README.md
file, a
.gitignore
file, and a bunch of other files needed for a Maven project. (There are also some Eclipse IDE project files in there, to make importing into Eclipse easier.) The initial version has a greeting from the instructor you can use as a model for your own additions. (While it is okay to be a little creative, say by adding a joke or quote, just don't go overboard and add too much!) The URL of the repo is shown below, in the step-by-step directions for each IDE. You can also view the
project's website
(generated by Maven from the initial version).
Following the directions below, you will create a GitHub account for yourself, and
clone
the current repo. (IDEs generally require a local repo to work with as well.)
You use the Git repo just like any other Java project. When you are done making a set of changes (for this project you only need to add a single line to
main
), you must
commit
your changes. That updates the local repository from your IDE's version. Next, you
Push
your changes to the class' GitHub repo. During this step you may discover another student has committed some changes after you had checked out the project. If so, you will need to
merge
your changes into the new version. You can also
update
your local copy of the project, over-writing your files with the latest ones from the repository, and make your change again.
You can perform other Git related operations with Eclipse or NetBeans. (Generally, I find the Git interface for NetBeans more intuitive than Eclipse.) It is expected that students will explore some of these operations. Eclipse assumes you may have multiple projects per repo, and thus creates a project top-level folder within the top (root) of the repo. NetBeans doesn't do that by default, but it is perfectly happy either way, so I set up the GitHub class repo using the Eclipse conventions.
Another issue is that Eclipse doesn't easily import non-Eclipse projects with existing sources. It can be done, but it was easier to create the default Eclipse project files ...
Git Workshop
Daniel Laufer on September 15, 2021
Get an overview of Git and GitHub including what they are, their purpose, how they work, how they interact with each other, and much more.
You will learn about essential Git commands and concepts and go through several short demos using them.
Additionally, you will learn how to collaborate with others on a project using Git and GitHub, and learn how to contribute to open-source projects.
All of this combined will allow students to learn an essential skill that will follow them through their career in tech!
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
Git Tutorial A Comprehensive Guide for Beginners.pdfuzair
flicts
If there are conflicts when merging changes, Git will prompt you to resolve them. You can use a variety of tools to resolve conflicts, including text editors and graphical merge tools.
Advanced Git Commands
git diff
The git diff command shows the differences between two different versions of a file:
phpCopy code
git diff <commit1> <commit2> <file>
git reset
The git reset command is used to reset the state of the repository to a specific commit:
perlCopy code
git reset <commit>
git stash
The git stash command is used to temporarily save changes that you are not yet ready to commit:
Copy code
git stash
Git Best Practices
Committing frequently
It is important to commit your changes frequently, rather than waiting until you have completed a large amount of work. This makes it easier to track changes and identify problems.
Writing meaningful commit messages
Your commit messages should be descriptive and provide context for the changes that you have made.
Creating descriptive branch names
Your branch names should be descriptive and provide context for the changes that you are working on.
Conclusion
In this guide, we have covered the basic concepts of Git, how to install it, and the
Git can be a complex tool, but with practice and experience, you will become more comfortable using it. If you have any questions or run into any issues, there is a wealth of resources available online, including documentation, forums, and tutorials.
Thank you for reading this comprehensive guide to Git for beginners.
FAQ
It provides a number of benefits, including the ability to collaborate with others, maintain a history of your code, and easily revert changes if necessary.
What is a repository in Git? A repository is a central location where your code is stored and managed. It contains all of the files and directories that make up your project, as well as a history of changes made to those files.
What is branching in Git? Branching is the process of creating a new line of development for your code. It allows you to work on new features or changes without affecting the main branch of your code.
How do I resolve merge conflicts in Git? When merging changes from one branch into another, you may encounter conflicts between different versions of the same file. Git provides tools to help you resolve these conflicts, including text editors and graphical meflicts
If there are conflicts when merging changes, Git will prompt you to resolve them. You can use a variety of tools to resolve conflicts, including text editors and graphical merge tools.
Advanced Git Commands
git diff
The git diff command shows the differences between two different versions of a file:
phpCopy code
git diff <commit1> <commit2> <file>
git reset
The git reset command is used to reset the state of the repository to a specific commit:
perlCopy code
git reset <commit>
git stash
The git stash command is used to temporarily save changes that you are not yet ready to commit:
Copy code
git sta
With these slides we introduce the concept of source control and teach the core features to using Git, GitHub and BitBucket. You can find the accompanying video here. https://youtu.be/lZpNrCgGvuI
At the end of this session, you will be able to:
* Install git
* Create a local git repository
* Add a file to the repo
* Add a file to staging
* Create a commit
* Create a new branch
* Create a GitHub repo
* Push a branch to GitHub
In this project, you will learn to use some of the team” features o.docxbreaksdayle
In this project, you will learn to use some of the “team” features of your preferred IDE (Eclipse or NetBeans). We will use the “Git” source code control system to allow all members of the class to work on the same project at the same time, and then to merge in your changes. This is a “real-world” way of working on code; few developers work on real projects by themselves. (And even then, version control is often useful and used.)
The project is a very simple one. The source file SayHello.java has a main method you need to edit. Add a statement to main to greet the class by displaying a unique string (so your contribution differs from other students'), which should include your name. (You are free to add additional output if you desire, such as a quote or joke.)
I have created a Git repository you can access from the
GitHub.com
. This repository contains the initial version of
SayHello.java
, a
README.md
file, a
.gitignore
file, and a bunch of other files needed for a Maven project. (There are also some Eclipse IDE project files in there, to make importing into Eclipse easier.) The initial version has a greeting from the instructor you can use as a model for your own additions. (While it is okay to be a little creative, say by adding a joke or quote, just don't go overboard and add too much!) The URL of the repo is shown below, in the step-by-step directions for each IDE. You can also view the
project's website
(generated by Maven from the initial version).
Following the directions below, you will create a GitHub account for yourself, and
clone
the current repo. (IDEs generally require a local repo to work with as well.)
You use the Git repo just like any other Java project. When you are done making a set of changes (for this project you only need to add a single line to
main
), you must
commit
your changes. That updates the local repository from your IDE's version. Next, you
Push
your changes to the class' GitHub repo. During this step you may discover another student has committed some changes after you had checked out the project. If so, you will need to
merge
your changes into the new version. You can also
update
your local copy of the project, over-writing your files with the latest ones from the repository, and make your change again.
You can perform other Git related operations with Eclipse or NetBeans. (Generally, I find the Git interface for NetBeans more intuitive than Eclipse.) It is expected that students will explore some of these operations. Eclipse assumes you may have multiple projects per repo, and thus creates a project top-level folder within the top (root) of the repo. NetBeans doesn't do that by default, but it is perfectly happy either way, so I set up the GitHub class repo using the Eclipse conventions.
Another issue is that Eclipse doesn't easily import non-Eclipse projects with existing sources. It can be done, but it was easier to create the default Eclipse project files ...
Git Workshop
Daniel Laufer on September 15, 2021
Get an overview of Git and GitHub including what they are, their purpose, how they work, how they interact with each other, and much more.
You will learn about essential Git commands and concepts and go through several short demos using them.
Additionally, you will learn how to collaborate with others on a project using Git and GitHub, and learn how to contribute to open-source projects.
All of this combined will allow students to learn an essential skill that will follow them through their career in tech!
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
This slide is special for master students (MIBS & MIFB) in UUM. Also useful for readers who are interested in the topic of contemporary Islamic banking.
Delivering Micro-Credentials in Technical and Vocational Education and TrainingAG2 Design
Explore how micro-credentials are transforming Technical and Vocational Education and Training (TVET) with this comprehensive slide deck. Discover what micro-credentials are, their importance in TVET, the advantages they offer, and the insights from industry experts. Additionally, learn about the top software applications available for creating and managing micro-credentials. This presentation also includes valuable resources and a discussion on the future of these specialised certifications.
For more detailed information on delivering micro-credentials in TVET, visit this https://tvettrainer.com/delivering-micro-credentials-in-tvet/
A review of the growth of the Israel Genealogy Research Association Database Collection for the last 12 months. Our collection is now passed the 3 million mark and still growing. See which archives have contributed the most. See the different types of records we have, and which years have had records added. You can also see what we have for the future.
Safalta Digital marketing institute in Noida, provide complete applications that encompass a huge range of virtual advertising and marketing additives, which includes search engine optimization, virtual communication advertising, pay-per-click on marketing, content material advertising, internet analytics, and greater. These university courses are designed for students who possess a comprehensive understanding of virtual marketing strategies and attributes.Safalta Digital Marketing Institute in Noida is a first choice for young individuals or students who are looking to start their careers in the field of digital advertising. The institute gives specialized courses designed and certification.
for beginners, providing thorough training in areas such as SEO, digital communication marketing, and PPC training in Noida. After finishing the program, students receive the certifications recognised by top different universitie, setting a strong foundation for a successful career in digital marketing.
The simplified electron and muon model, Oscillating Spacetime: The Foundation...RitikBhardwaj56
Discover the Simplified Electron and Muon Model: A New Wave-Based Approach to Understanding Particles delves into a groundbreaking theory that presents electrons and muons as rotating soliton waves within oscillating spacetime. Geared towards students, researchers, and science buffs, this book breaks down complex ideas into simple explanations. It covers topics such as electron waves, temporal dynamics, and the implications of this model on particle physics. With clear illustrations and easy-to-follow explanations, readers will gain a new outlook on the universe's fundamental nature.
Strategies for Effective Upskilling is a presentation by Chinwendu Peace in a Your Skill Boost Masterclass organisation by the Excellence Foundation for South Sudan on 08th and 09th June 2024 from 1 PM to 3 PM on each day.
A workshop hosted by the South African Journal of Science aimed at postgraduate students and early career researchers with little or no experience in writing and publishing journal articles.
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
1. A Tutorial for Git and
GitHub
Xiao Li
Department of Informatics
University of Zurich
2. Agenda
Why use Version (Source) Control Systems
What are Git and GitHub
Basic Git Commands
Fundamentals of GitHub
Using GitHub in Project Implementation
3. 3
Why version control?
Scenario 1:
Your program is working
You change “just one thing”
Your program breaks
You change it back
Your program is still broken--why?
Has this ever happened to you?
4. 4
Why version control? (part 2)
Your program worked well enough yesterday
You made a lot of improvements last night...
...but you haven't gotten them to work yet
You need to turn in your program now
Has this ever happened to you?
5. 5
Version control for teams
Scenario:
You change one part of a program--it works
Your co-worker changes another part--it works
You put them together--it doesn’t work
Some change in one part must have broken something in the
other part
What were all the changes?
6. 6
Teams (part 2)
Scenario:
You make a number of improvements to a
class
Your co-worker makes a number of different
improvements to the same class
How can you merge these changes?
7. 7
Version control systems
A version control system (often called a source code
control system) does these things:
Keeps multiple (older and newer) versions of everything (not
just source code)
Requests comments regarding every change
Allows “check in” and “check out” of files so you know which
files someone else is working on
Displays differences between versions
8. Benefits of version control
For working by yourself:
Gives you a “time machine” for going back to earlier versions
Gives you great support for different versions (standalone, web
app, etc.) of the same basic project
For working with others:
Greatly simplifies concurrent work, merging changes
8
9. What are Git and GitHub
Git is a free and open source distributed version control
system designed to handle everything from small to very
large projects with speed and efficiency
GitHub is a web-based Git repository hosting service,
which offers all of the distributed revision control and
source code management (SCM) functionality of Git as
well as adding its own features.
10. How to setup Git and GitHub
Download and install the latest version of GitHub
Desktop. This will automatically install Git and keep it up-
to-date for you.
https://help.github.com/articles/set-up-git/
12. Introduce yourself to Git
On your computer, open the Git Shell application.
Enter these lines (with appropriate changes):
git config --global user.name "John Smith"
git config --global user.email jsmith@seas.upenn.edu
You only need to do this once
If you want to use a different name/email address for a
particular project, you can change it for just that project
cd to the project directory
Use the above commands, but leave out the --global
12
13. The repository
Your top-level working directory contains everything about your project
The working directory probably contains many subdirectories—source code, binaries,
documentation, data files, etc.
One of these subdirectories, named .git, is your repository
At any time, you can take a “snapshot” of everything (or selected things) in
your project directory, and put it in your repository
This “snapshot” is called a commit object
The commit object contains (1) a set of files, (2) references to the “parents” of the commit
object, and (3) a unique “SHA1” name
Commit objects do not require huge amounts of memory
You can work as much as you like in your working directory, but the
repository isn’t updated until you commit something
13
14. init and the .git repository
When you said git init in your project directory, or
when you cloned an existing project, you created a
repository
The repository is a subdirectory named .git containing various
files
The dot indicates a “hidden” directory
You do not work directly with the contents of that directory;
various git commands do that for you
14
15. Making commits
You do your work in your project directory, as usual
If you create new files and/or folders, they are not tracked by Git unless you ask it to do so
git add newFile1 newFolder1 newFolder2 newFile2
Committing makes a “snapshot” of everything being tracked into your repository
A message telling what you have done is required
git commit –m “Uncrevulated the conundrum bar”
git commit
This version opens an editor for you the enter the message
To finish, save and quit the editor
Format of the commit message
One line containing the complete summary
If more than one line, the second line must be blank
15
16. Commits and graphs
A commit is when you tell git that a change (or addition) you have made is
ready to be included in the project
When you commit your change to git, it creates a commit object
A commit object represents the complete state of the project, including all the files in
the project
The very first commit object has no “parents”
Usually, you take some commit object, make some changes, and create a new commit
object; the original commit object is the parent of the new commit object
Hence, most commit objects have a single parent
You can also merge two commit objects to form a new one
The new commit object has two parents
Hence, commit objects forms a directed graph
Git is all about using and manipulating this graph
16
17. Commit messages
In git, “Commits are cheap.” Do them often.
When you commit, you must provide a one-line message
stating what you have done
Terrible message: “Fixed a bunch of things”
Better message: “Corrected the calculation of median scores”
Commit messages can be very helpful, to yourself as well
as to your team members
You can’t say much in one line, so commit often
17
18. Typical workflow
git status
See what Git thinks is going on
Use this frequently!
Work on your files
git add your editfiles
git commit –m “What I did”
18
19. Keeping it simple
If you:
Make sure you are current with the central repository
Make some improvements to your code
Update the central repository before anyone else does
Then you don’t have to worry about resolving conflicts or working
with multiple branches
All the complexity in git comes from dealing with these
Therefore:
Make sure you are up-to-date before starting to work
Commit and update the central repository frequently
If you need help: https://help.github.com/
19
22. Introduce yourself to GitHub
Register on GitHub
https://github.com/
Authenticating to GitHub Desktop
https://help.github.com/desktop/guides/getting-
started/authenticating-to-github/
Configuring Git for GitHub Desktop
https://help.github.com/desktop/guides/getting-
started/configuring-git-for-github-desktop/
23. Create or add a repository to GitHub
Create a new repository on GitHub
https://help.github.com/articles/create-a-repo/
From GitHub Desktop, then Publish to GitHub
https://help.github.com/desktop/guides/contributing/adding-a-
repository-from-your-local-computer-to-github-desktop/
Remember to Publish, otherwise your repository would not
appear on the GitHub website.
24. Commit your changes on GitHub
From GitHub Website
https://help.github.com/articles/create-a-repo/
From GitHub Desktop
https://help.github.com/desktop/guides/contributing/committing-
and-reviewing-changes-to-your-project/
25. Creating a branch for your work
A branch is a parallel version of the main line of
development in the repository, or the default branch
(usually master). Use branches to
Develop features
Fix bugs
Safely experiment with new ideas
From the GitHub Website
https://help.github.com/articles/creating-and-deleting-branches-within-your-repository/
From the GitHub Desktop
https://help.github.com/desktop/guides/contributing/creating-a-branch-for-your-work/
26. Synchronizing your branch
As commits are pushed to your project on GitHub, you
can keep your local copy of the project in sync with the
remote repository.
https://help.github.com/desktop/guides/contributing/syncing-
your-branch/
27. Viewing the history of your commits
When you click a commit on the commit timeline, you can
see more details about the commit, including a diff of the
changes the commit introduced.
Each commit shows:
The commit message
The time the commit was created
The committer's username and profile photo (if available)
The commit's SHA-1 hash (the unique ID)
28. Revert your commit
If you change your mind about a commit after you create
it, you can revert the commit.
When you revert to a previous commit, the revert is also a
commit. In addition, the original commit remains in the
repository's history.
https://help.github.com/desktop/guides/contributing/reverti
ng-a-commit/
29. Fork & Pull: A Collaborative model
A fork is a copy of a repository that you manage. Forks let
you make changes to a project without affecting the
original repository. You can fetch updates from or submit
changes to the original repository with pull requests.
A great example of using forks to propose changes is for
bug fixes. Rather than logging an issue for a bug you've
found, you can:
Fork the repository.
Make the fix.
Submit a pull request to the project owner.
30. Using GitHub in Project Implementation
In the section of project implementation in your project
report, you may describe:
How you use GitHub in your project
How version control helps your quality management
How you collaborate with your teammate in GitHub
31. References
Some content of the slides are adapted from:
https://help.github.com/desktop/guides/getting-started/
https://help.github.com/desktop/guides/contributing/
https://help.github.com/categories/collaborating/
http://www.cis.upenn.edu/~matuszek/cit591-
2012/Lectures/git.ppt