
Here's a comprehensive guide to get you started with GitHub.
GitHub is a web-based platform for version control and collaboration on software development projects. It's a hub for developers to share and manage their code.
To create a new repository on GitHub, you need to click on the "+" button on the top right corner of the page and select "New repository". This will take you to a page where you can fill in the details of your repository.
You can also create a repository using the command line interface by running the command `git add .` followed by `git commit -m "initial commit"` and then `git remote add origin https://github.com/username/repository.git`.
To clone a repository, you need to run the command `git clone https://github.com/username/repository.git` in your terminal. This will create a local copy of the repository on your computer.
A unique perspective: How to Clone Azure Repo
Basic Operations
To get started with GitHub, you'll need to understand some basic operations. You can checkout a single file from a different branch, which is super helpful when you need to reference code from another part of the project.
You can also apply a specific commit from another branch, which is a great way to bring in changes from a different part of the project. This can be a lifesaver when you need to fix a bug or add a new feature.
If you need to rename the current branch, you can do that too. Just be aware that renaming a branch doesn't affect the code itself, it just changes the name.
Initialize New Repository
To initialize a new repository, start by running the command "git init" in your current directory. This will kick off a new Git repository and set you up for success.
You can also create a repository in a specific directory, which can be useful for organizing your projects. To do this, use the command "git init" followed by the directory path.
For example, if you want to create a repository in a directory called "myproject", you would run the command "git init myproject".
You might like: How to Create Filter Dropdown in Google Sheet
Stashing
Stashing is a lifesaver when you need to switch branches but don't want to commit your changes yet. Git stash temporarily saves your changes and reverts to the last commit, allowing you to switch branches without losing your work.
To save your current changes temporarily, use the command git stash. This will stash your changes and revert to the last commit, making it easy to switch branches.
You can also apply the last stashed changes with the command git stash apply. This is useful if you want to continue working on the changes you stashed.
If you need to apply specific stash changes, use the command git stash apply stash@{n}, replacing n with the number of the stash you want to apply.
To see a list of available stashes, use the command git stash list. This will show you a list of all the stashes you've made, with the most recent one at the top.
Finally, if you want to remove the last stash, use the command git stash drop.
Related reading: Add Drop down to Google Sheet
Fetch

Fetch is a fundamental operation in Git that allows you to download changes from a remote repository.
You can use git fetch to download new commits without merging them, which lets you review the changes before merging.
Unlike git pull, git fetch doesn't merge the new commits, it only downloads them.
This means you can inspect the changes and decide whether to merge them or not.
Git fetch is a safe way to update your local repository without affecting your working files.
It's a good practice to use git fetch before merging changes to avoid any potential conflicts.
Push Publish
Pushing your commits to a remote repository is a crucial step in sharing your work with others.
To do this, you'll use the command `git push`. This updates the remote branch with your local commits.
If you want to share tags with others, you'll need to push them to the remote repository. By default, tags are local, but they can be super useful for keeping track of releases and other significant project changes.
Here are some useful aliases for pushing your commits:
Keyboard Shortcuts
Keyboard Shortcuts are a game-changer for navigating repository pages quickly.
To see all of the shortcuts for the current page, press the "?" key.
Ignore Whitespace
When working with diffs on GitHub, it's easy to get overwhelmed by changes in whitespace. Adding ?w=1 to any diff URL will remove any changes only in whitespace, enabling you to see only the code that has changed.
This feature is super helpful when reviewing code changes, as it allows you to focus on the actual code modifications rather than formatting changes.
Checkout
Checkout is a powerful Git command that lets you switch between branches, check out specific commits or files, and even discard changes in a file.
You can use git checkout to switch between branches, which is especially useful when working on multiple projects or features.
To switch between branches, you can use the command git checkout, as mentioned in example 3.
If you want to discard changes in a specific file and revert it to the last committed state, git checkout is your go-to command, as stated in example 4.
You might like: Get Link to Specific Sheet in Google Sheets
You can also use git checkout to apply a specific commit from another branch, as shown in example 1.
To checkout a single file from a different branch, you can use the same command, git checkout, as demonstrated in example 1.
Renaming the current branch is also possible with git checkout, as mentioned in example 1.
Deleting a local branch can be done using the command git checkout, with a specific option, as shown in example 1.
Fixup and Autosquash
Fixup and Autosquash is a powerful tool that helps you clean up previous commits that had issues.
If you've made a mistake in a previous commit, you can fix it with a fixup commit. To do this, you need to run a command after you've amended the problem.
You can fix up one or more commits from HEAD, which means the most recent commits you've made. For example, if you want to fix a commit called abcde, you can use the fixup command.
After you've fixed the issue, you'll need to autosquash the fixup commit. Autosquash helps you combine the fixup commit with the previous commit, making it easier to review and understand your changes.
Autosquash is a great tool to have in your toolkit, especially when working on complex projects with many commits.
Remote Management
Remote Management is an essential part of working with Git repositories. You can view or set the remote repositories for your project using the command `git remote`.
To list configured remotes, simply type `git remote` and it will show you a list of remote repositories you've set up. Note that this only removes the remote reference locally, not the remote repository itself.
You can add a git URL as an alias using the `#Remote` command, and then show the names of the remote repositories you've set up using the same command.
Expand your knowledge: Google Sheet Get Sheet Using Name
Remote
You can add a git URL as an alias by using the remote management feature in Git. This creates a shortcut for the URL, making it easier to work with remote repositories.
Curious to learn more? Check out: Git Remote Add Azure

To view the names of the remote repositories you've set up, simply type "git remote" in your terminal. This will list all the remote repositories associated with your project.
If you want to see the names and URLs of the remote repositories, you can use the "git remote" command with the "-v" option. This will provide detailed information about each remote repository.
Removing a remote repository is as simple as typing "git remote remove [remote name]". Note that this only removes the remote reference locally, not the remote repository itself.
You can also change the URL of a git repository using the "git remote set-url" command. This is useful if the repository's URL has changed or if you want to use a different alias.
Styled Status
To get a clear picture of your repository's status, you can use the styled Git status command by adding -sb. This will display a neat and organized table showing the differences between your local and remote repositories.
Broaden your view: Google Sheet Status Dropdown

You can view the working directory status by using the Git status command, which will show you the changes to tracked files. This is a quick way to see what's changed without having to dig through your files.
By adding -sb to the Git status command, you can also view changes in specific files. This is especially useful when you're working on a large project and need to focus on a particular file.
To commit with a specific date, you can use the commit command with the date you want to use. However, this isn't directly related to styled status, but it's an important feature to know about when managing your repository.
Merge and Rebase
Merge and Rebase are two powerful Git tools that help you integrate changes from one branch into another.
To merge a branch into the current HEAD, you can use the command `git merge`. This is especially handy for merging features from a development branch into your main branch.
You can configure your merge tool globally with `git config --global merge.tool`. Then, use the configured tool with `git merge -tool`.
A warning: don't rebase published commits, as it can lead to confusion and lost history.
To rebase a branch, use the command `git rebase`. This is useful for keeping a feature branch up to date with the main branch.
You can abort a rebase with `git rebase --abort` or continue after resolving conflicts with `git rebase --continue`.
Discover more: How to Use Git Hub
Reset and Clean
Resetting your repository to a previous commit is as easy as using `git reset`. You can choose to just unstage changes or discard them completely, depending on the option you use.
To reset to the previous commit and discard all changes, use `git reset`. To reset to the remote branch state, use the same command with the right option.
If you want to preserve your changes as unstaged or uncommitted local changes, you can use `git reset` with specific options.
Squashing
Squashing is a powerful technique that can help you clean up your commit history. It's a form of interactive rebase that lets you squash multiple commits into a single one.
To squash commits, you'll use the "Interactive rebase for squashing" option. This allows you to select which commits to squash and how to rewrite the commit history.
Squashing can be a big help when you've made a series of small commits that don't reflect the actual work done. It's a way to condense that work into a single, meaningful commit.
Reset Operations
Resetting your repository can be a lifesaver, especially when you've made changes you no longer want. You can reset to a previous commit by using the command 'git reset'.
To reset to a previous commit, you can use the 'git reset' command with the '--hard' option to discard all changes. This will completely reset your repository to the previous commit, so make sure you're ready to lose any unsaved work.
Expand your knowledge: Azure Devops Git Repository

If you've made changes but don't want to lose them, you can use the '--mixed' option to reset the index but leave your working directory unchanged. This way, you can still access your changes, but they won't be committed.
You can also reset to the state of a remote branch by using the 'git reset' command with the '--hard' option and specifying the remote branch name. This is useful when you want to bring your local repository in sync with the remote branch.
If you've made changes but haven't committed them, you can use the '--soft' option to reset the index but leave your working directory unchanged. This way, you can still access your changes, but they won't be committed.
To track a remote release, you can use the 'git reset' command with the '--hard' option and specifying the remote branch name. This will update your local repository to match the remote branch.
Clean Ignored Files
I've accidentally committed files that I meant to ignore. To fix this, I can use the command "git clean" to remove them. This will permanently delete the files.
Be careful using "git clean" because it will remove untracked files in your working directory.
You can avoid deleting important files by checking the changes before running the command.
Consider reading: Google Sheet Remove Hyperlink
Empty
Empty commits can be a useful tool in Git. You can push commits with no code changes by adding --allow-empty to the command.
This can be useful for annotating the start of a new bulk of work or a new feature. For example, you can create a commit with no code changes to mark the beginning of a new feature.
Some other use-cases include documenting when you make changes to the project that aren't code related. This can be helpful for communicating with people using your repository.
Here are some examples of when you might use an empty commit:
- Annotating the start of a new bulk of work or a new feature.
- Documenting when you make changes to the project that aren't code related.
- Communicating with people using your repository.
- The first commit of a repository: `git commit -m "Initial commit" --allow-empty`.
Tags and Versioning
Tags in Git are like bookmarks for important moments in your project's history, perfect for marking releases or milestones. They make versioning easier and let you easily refer to key commits.
A lightweight tag is a simple pointer to a commit. This type of tag doesn't store any additional information.
Annotated tags are more informative, including details like the tagger's name, date, and message. This makes it easier to track who made a particular tag and why.
Here's an interesting read: Html Tags Cheat Sheet
You might enjoy: Git Hub Tags
History and Log
To view the commit history on GitHub, you can use the "Commit History" feature. Simply click on the "Show all commits (detailed)" link to see a detailed list of all the commits in the repository.
If you want a more concise view of the commit history, use the `git log --oneline` command. It shows each commit on a single line, including the commit hash and message.
You can also view the commit history by author by adding `?author={user}` to the URL. This will show you all the commits made by a specific author.
History

To view a detailed commit history, use the git log command, which gives you a list of all the commits in the repository, including messages, author details, and timestamps.
You can also use git log --oneline for a more concise version, showing each commit on a single line with the commit hash and message. This is a great way to quickly scan through the commit history.
If you want to see the commit history by author, use git shortlog, which groups commits by author and shows how many commits each author has made.
To view all commits on a repo by author, add ?author={user} to the URL, which will filter the commit history to show only the commits made by that specific author.
Bisection
Bisection is a powerful tool for tracking down bugs in your code. Git bisect is a binary search through the commit history that checks out commits between a known "good" and "bad" commit to find the issue.

To use git bisect, you need a good commit and a bad commit to compare. This allows the binary search to narrow down the problematic commit.
Git bisect does a binary search, which is a fast way to find the issue by dividing the search space in half with each step. This makes it more efficient than a linear search.
Readers also liked: Google Search Operators Cheat Sheet
Comparing and Cloning
You can make a copy of an existing repository with git clone, which creates a local copy of a remote repository right on your machine.
To clone a repository, you can leave off the .git at the end.
To compare all branches to another branch, go to the repo's Branches page and click on the compare page next to the Commits button.
Comparing
Comparing is a crucial part of working with Git and GitHub. You can compare branches across forked repositories by changing the URL to look like {repo owner}/{repo name}/compare/{range}, where {range} can be a branch name or a specific commit hash.

To compare branches, change the URL to look like this: {repo owner}/{repo name}/compare/{range}, where {range} can be a branch name or a specific commit hash. For example, {repo owner}/{repo name}/compare/master...4-1-stable.
You can also compare all branches to another branch by going to the repo's Branches page and clicking on the compare button next to the Commits button. From here, you can access the compare page or delete a branch with a click of a button.
To get a diff of a Pull Request, add a .diff or .patch extension to the end of the URL. For example, {repo owner}/{repo name}/pulls/{pull request number}/diff or {repo owner}/{repo name}/pulls/{pull request number}/patch.
You can also use the git diff command to see the differences between your working directory and the last commit. This can be helpful when trying to understand what changes have been made to your code.
Suggestion: Pull Data from One Google Sheet to Another
Cloning a Repository
Cloning a repository is a straightforward process that lets you create a local copy of a remote repository. You can use the git clone command to do this.
To clone a repository, you can use the git clone command. The .git can be left off the end.
If you're working with GitHub Flavored Markdown, you'll want to check out the documentation for more information on using the git clone command.
Grep

Grep is a powerful tool in Git that allows you to search for specific patterns within your codebase. It's a simple yet effective way to find what you're looking for.
You can use Git Grep to search for specific strings within your files. For example, using the command "Git Grep" will show all the files containing the string "aliases".
To narrow down your search, you can use flags like -e to specify a pattern, such as a regular expression. You can also combine multiple patterns using --and, --or, and --not.
Here's a quick rundown of how to use these flags:
- -e: The next parameter is the pattern (e.g., regex)
- --and, --or, and --not: Combine multiple patterns
For instance, if you want to find branches that haven't been merged into your current branch, you can use the command "Read more about the Git grep command."
Troubleshooting and Recovery
Mistakes happen, but Git has your back when it comes to fixing them.
Git has a range of commands to help you get back on track, whether you need to reset, revert, or discard changes.

You can use the `git reset` command to undo changes and discard local modifications, but be careful as it will also reset the branch pointer.
To reset a commit, use `git reset --soft HEAD~1` to undo the last commit and keep the changes in your staging area.
Reverting a commit can be done with `git revert`, which creates a new commit that undoes the changes made in the original commit.
If you've made changes and want to start over, use `git reset --hard` to discard all local modifications and reset the branch pointer.
Discarding changes can be done with `git checkout -- .` to discard all local modifications and return the files to their previous state.
Contributing and Collaboration
Contributing to a GitHub project is a breeze. You can report bugs or typos, add new Git commands, translate to new languages, improve explanations, or enhance formatting.
To contribute, simply fork the repository, create a feature branch, commit your changes, and push to the branch. Then, open a Pull Request.
GitHub supports adding three different files that help users contribute to your project. These files can be placed in the root of your repository or a .github directory under the root.
You can retrieve a specific Pull Request locally by using the FETCH_HEAD command. Alternatively, you can acquire all Pull Request branches as local remote branches by refspec.
Want to checkout Pull Requests automatically? Simply add the corresponding lines to your repository's .git/config file.
Expand your knowledge: Google Dorking Cheat Sheet Github
Repository Management
To manage your repositories on GitHub, you can start by initializing a new one in the current directory. This is done with the command "git add . && git commit -m 'initial commit'" but for simplicity, you can use the GitHub Desktop application.
You can also create a repository in a specific directory by navigating to that directory in your terminal or command prompt and running the command "git add . && git commit -m 'initial commit'".
Creating a repository on GitHub is a straightforward process that can be completed in just a few steps.
Query and Search
You can use Git Query to search all your previous commit messages and find the most recent one matching the query. This is a powerful tool for tracking down specific changes made over time.
To use Git Query, simply type `git query` followed by the term you want to search for, and it will find the last matching commit and give you details on the lines that were changed.
If you need to search for a specific keyword in your commits, you can also use Git's Commit Search feature. This allows you to search with regular expressions and find the commits that introduced the keyword.
Readers also liked: How to Form Table from Query in Google Sheet
Query
Query allows you to search through your previous commit messages to find the most recent one matching your query.
Git Query is a powerful tool that lets you search all your previous commit messages, making it easy to find the most recent one matching your query.
Intriguing read: Google Sheet Find

A query can be any term you want to search for, and it's case-sensitive, so be sure to get the spelling and capitalization just right.
Git Query will return details on the lines that were changed, so you can see exactly what was updated.
Press q to quit the search if you need to stop looking for a specific query.
You might enjoy: Gsheets Query
CI Status
CI Status is a powerful tool that helps you keep track of your code's quality. It's set up to build every Pull Request just like it would a new commit.
With Travis CI, you can get instant feedback on your code's status. This is especially useful when you're working with others, as it ensures everyone is on the same page.
You can read more about how to get started with Travis CI, which is a great resource for beginners. The commit status API is also worth checking out for more advanced users.
Search functionality is available on the Status API, allowing you to quickly find what you need. This is a huge time-saver, especially when you're dealing with a large codebase.
You might like: Google Sheet Api Javascript
Articles
Here's a section on "Articles" as part of a "git hub cheat sheet" article:
GitHub Flow is a lightweight and flexible workflow that guides you through the process of managing your codebase. It's a simple way to manage your code and collaborate with others.
You can find more information on GitHub Flow at http://scottchacon.com/2011/08/31/github-flow.html.
Migrating to Git Large File Storage (Git LFS) is a great way to handle large files in your repository. This is especially useful for developing deep learning applications with large files.
Here are some key resources to get you started with Git LFS:
- Migrating to Git Large File Storage (Git LFS) is a great way to handle large files in your repository.
- Find more information on migrating to Git LFS at http://vooban.com/en/tips-articles-geek-stuff/migrating-to-git-lfs-for-developing-deep-learning-applications-with-large-files/.
Featured Images: pexels.com


