Collaboration is the way different people can work on the same project together. It is like creating a group in GitHub just like Groups in other social media. The people added in the collaborator’s list can be able to push, merge, and do other kinds of similar things on the project.
For doing collaboration you need to follow the steps given below:
Step 1: Create a Repository
Step 2: Add files to your project.
Open Git Bash into your local working directory where files are saved and follow the commands:
$ git init $ git add $ git commit -m "initial commit" $ git remote add origin remote repository URL $ git remote -v $ git push -f origin master
Step 3: Adding your Collaborators.
Click on setting and then follow below steps :
After clicking on “Invite a collaborator” fill the required details and then you are done.
Note: In order to perfectly work in a collaborative team you need to know below terminologies and their applications.
Creating signed and unsigned tags
First, the question arises why do we sign a code?
Well, the reason is that it shows the authority of the code, that who has written it, and who needs to be blamed if any bug arises. To create a simple tag just write:
$ git tag example
This creates tag based on the current repository’s version.
In order to create unsigned annotated tag containing a message just write :
$ git tag -a v1 -m "Version 1 release"
At last if you want to sign on a tag just write :
$ git tag -s mytag
In order to verify your signed tag just write :
$ git tag -v mytag
git checkout command lets you navigate between the branches created by git branch. It lets you to check files in the working directory to match the version stored in that branch.
$ git checkout branch_name
This command can be easily confused with
git clone but both are different. The difference between the two commands is that clone works to fetch code from a remote repository, alternatively, checkout works to switch between versions of code already on the local system.
Other related Terminologies
This command is used to push the files from your local machine to the GitHub repository.
$ git push -f origin master
It is useful when you are interacting with remote repository. Basically this command is used to retrive the work done by other people and update your local project accordingly.
$ git fetch remotename
- pull request
It is a method of submitting your contributions to the project. It occurs when a developer asks for changes committed to an external repository to be considered for inclusion in a project’s main repository after the peer review.
$ git pull remote_name
Fetch the specified remote’s copy of the current branch and immediately merge it into the local copy. This command is same as
git fetchfollowed by
- Deleting any tag
For deleting any tag navigate to your local GitHub repository and type the following command :
$ git tag -d tagName $ git push origin :tagName
GitHub provides users the feature to search code with a repository or organisation. Well there is some restrictions also imposed by GitHub while searching the code. This restrictions are imposed due to complexity of searching code. Below are the valid searches you can perform on GitHub.
- Search by the file contents or file path
- Search within a user’s or organization’s repositories
- Search by file location or file size
- Search by language
- Search by file name or file extension
Check previous logs
To look back into what are all the commits which are made in the repository you can simply use :
By default, if no argument is passed with this command. It will show the logs in reverse chronological order.
- Pushing changes to a Git Repository
- What is a GIT Repository?
- Git Features
- Bare Repositories in Git
- Working with Git Repositories
- Merge Strategies in Git
- Getting changes from a Git Repository
- Git | Working with Stash
- Handling repositories with Git remote
- Using Git on CommandLine
- Working on BitBucket using Git
- Working on Git for GUI
- Using Patches in Git
- Rebasing of branches in Git
- Recovering Lost Commits in Git
- Working on Git Bash
- Jenkins and GIT Integration using SSH Key
- Difference Between Git and GitHub
- Using Tags in Git
- Patch Operation in Git
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.