Git_Lec2
Git_Lec2
• git reset basically resets the repo, throwing away some changes. It’s
somewhat difficult to understand, so reading the examples in the
documentation may be a bit more useful.
• git revert makes a new commit which effectively rolls back a previous
commit. It’s a bit like an undo command.
git branch Used to manage branches
git branch <name> Creates the branch
git branch -d <name> Deletes the branch
git branch -D <name> Forcibly deletes the branch
git checkout <branch> Switches to a branch.
git checkout -b <branch> Creates a new branch and switches to it.
1.Create a branch: Topic branches created from the canonical deployment branch
(usually main) allow teams to contribute to many parallel efforts. Short-lived topic
branches, in particular, keep teams focused and results in quick ships.
3.Open a pull request: Pull requests publicize a project’s ongoing efforts and set the
tone for a transparent development process.
Github Workflow
4.Discuss and review code: Teams participate in code reviews by commenting,
testing, and reviewing open pull requests. Code review is at the core of an open and
participatory culture.
6.Deploy: Teams can choose the best release cycles or incorporate continuous
integration tools and operate with the assurance that code on the deployment
branch has gone through a robust workflow.
Steps to Add a New Repo
1. In the upper-right corner of any page, use the drop-down
menu, and select New repository.
2. Type a short, memorable name for your repository. For
example, "hello-world".
3. Optionally, add a description of your repository. For example,
"My first repository on GitHub.“
4. Choose a repository visibility.
5. Select Initialize this repository with a README.
6. Click Create repository.
Commit your first change
• A commit is like a snapshot of all the files in your project at a
particular point in time.
# update all remote tracking branches, and the currently checked out
branch
git pull
• Fork and pull - For an open source project, or for projects to which
anyone can contribute, managing individual permissions can be
challenging, but a fork and pull model allows anyone who can view
the project to contribute
Some Resources
• The GitHub team has created a library of educational videos and
guides to help users continue to develop their skills and build better
software.