How to use the Git and Git Hub for your projects

GitHubGitHub is a web-based service for version control using Git. Basically, it is a social networking site for developers. You can look at other people’s code, identify issues with their code and even propose changes

It makes it easy to contribute to your open source projects


To be honest, nearly every open-source project uses GitHub to manage their project. Using GitHub is free if your project is open source and includes a wiki and issue tracker that makes it easy to include more in-depth documentation and get feedback about your project.

If you want to contribute, you just fork a project, make your changes and then send them a pull request using GitHub web interface.

GitHub is a repository
This was already mentioned before, but it’s important to note, GitHub is a repository.
What this means that it allows your work to get out there in front of the public. Moreover, GitHub is one of the largest coding communities around right now, so it’s wide exposure for your project.

 Showcase your work
Are you a developer and wishes to attract recruiters? GitHub is the best tool you can rely on for this. Today, when searching for new recruits for their project, most companies look into the GitHub profiles. If your profile is available, you will have a higher chance of being recruited even if you are not from a great university or college.

so lets see what are the command in Git Hub when user use version controll.

if you want to working with version controlling you need to create your own repository to do that first of all install the git bash for your personal computer and then open the git bash and type bellow code in there.

Observe your Repository

$ git init [Your project Name ]

to download the an existing repositiry

$ git clone [url of the git hub with that repo]

1.If you want to List or Modified files not yet commited

$ git status

2.to see the files that not staged yet

$ git diff

Show the changes to staged files

$ git diff –cached

Show all staged and unstaged file changes $ git diff HEAD

Show the changes between two commit ids

$ git diff commit1 commit2

List the change dates and authors for a file

$ git blame [file]

Show the file changes for a commit id and/or file

$ git show [commit]:[file]

Show full change history

$ git log

Show change history for file/directory including diffs

$ git log -p [file/directory]

Working with Branches

List all local branches

$ git branch

List all branches, local and remote

$ git branch -av

Switch to a branch, my_branch, and update working directory

$ git checkout my_branch

Create a new branch called new_branch

$ git branch new_branch

Delete the branch called my_branch

$ git branch -d my_branch

Merge branch_a into branch_b

$ git checkout branch_b

$ git merge branch_a

Tag the current commit

$ git tag my_tag

Make a change


Observe your Repository List new or modified files not yet committed

$ git status

Show the changes to files not yet staged

$ git diff

Show the changes to staged files

$ git diff –cached

Show all staged and unstaged file changes

$ git diff HEAD

Show the changes between two commit ids

$ git diff commit1 commit2

List the change dates and authors for a file

$ git blame [file]

Show the file changes for a commit id and/or file

$ git show [commit]:[file]

Show full change history

$ git log

Show change history for file/directory including diffs

$ git log -p [file/directory]


Stages the file, ready for commit

$ git add [file]

Stage all changed files, ready for commit

$ git add .

Commit all staged files to versioned history

$ git commit -m “commit message”

Commit all your tracked files to versioned history

$ git commit -am “commit message”


Unstages file, keeping the file changes

$ git reset [file]

Revert everything to the last commit

$ git reset –hard

Synchronize

Get the latest changes from origin (no merge)

$ git fetch

Fetch the latest changes from origin and merge

$ git pull

Fetch the latest changes from origin and rebase

$ git pull –rebase

Push local changes to the origin

$ git push

Conclusion

In this post i tried to give you an overall idea about How to use the Git-hub properly that can be helped to maintain your projects very well.and also you have to practice these command util it save in your mind.that;s how your projects going with git hub .

using git hub your projects will be more better so if you don’t use git hub until today use it now and feel the different about it. definitely you will be happy with it.

Leave a comment