Git and GitHub Flashcards
Search query in GitHub
dotnet stars:> 1000
searches for the word dotnet where the project received more than 1000 stars
dotnet NOT “hello world”
word dotnet and not contain “hello world”
Download recent changes to the repo OR add the missing branches
git fetch
Download recent changes to the repo AND merge the changes
git pull
File that will make sure that the changes are reviewed before they are implemented
CODEOWNERS
Inside the file do:
@kristina-abrahamyan
Collaborator vs Contributor
Collaborator can edit the code.
Contributor can only create requests that will need to be reviewed before the code is allowed to be edited.
Create a new branch
git branch [branch-name]
To switch to a local branch
git checkout -b [branch-name]
if the branch already exists, we are simply switching to it, if not, git creates this new branch
Pushing to the GitHub the newly created branch.
The new branch created through Git is only stored locally until it’s pushed to GitHub through this way.
git push -u origin [branch-name-chosen-locally]
When a merging issue arises
- git push
- git pull
- code changed_file.py
- delete the version we don’t like + save the file and close it in the editor
- git commit -am “resolved merge conflict”
- git push
File name to put that info in the description part of the Pull Request (PR), i.e. the template for the PR
pull_request_template.md
Forks in GitHub
Copy of the existing repo.
Forking is available to anyone.
Forks are not available in Git.
Fork creates your own personal repository, so when you make changes and push them, they are pushed to this forked repo.
When you think that the changes are worth being mentioned in the upstream/original repository, you can create a PR (pull request).
Looking through the history of commits using Git
git log
To exit, use –> q
git log –oneline –graph –decorate –all
To see the tags associated with commits
git tag
Create a tag that points to repo main
git tag stable main
Create an annotated tag pointing to a specific commit done before
git tag -a v0.1 -m “0.1 Release” 0eff960