Git is a version control software used to manage objects. These objects can be anything from code in any language, to image, to text files. git stores all this information in 'repository'. Git is free and open source. Git is very powerful and easy to learn and use.
Installation : Git
Basic Commands:
Here are some basic git commands which can be helpful from time to time for a newbie or noob.
git init - To create and initialise repository in the current local path/folder
After issuing this command, it creates a hidden .git folder to store all the information
git status - Once you create some objects in the local repository, this status command can help to track the changes in object.
git add <ObjectName> - This is used to add an object to staging, which basically means it is ready to be pushed to remote repository. You can use 'git add .' to stage all the objects in the path. You can also use wildcard characters here. If you don't want certain files to be tracked. You can create a .gitignore file and specify the details there.
git commit - m "<Your Commit Message>" - This is used to commit the changes
git log - Shows commit history with basic details
git branch <BranchName> - To create new branch. Branches are used when you want to do the change without impact the original file. The name of main branch is 'master'.
git checkout <BranchName> - To switch to a branch.
git branch -d <BranchName> - To delete branch.
git diff <SourceBranch> <TargetBranch> - shows difference between source and target branch.
git merge <BranchName> - First switch to master branch. Then issue this command so that all the changes done in <BranchName> will be merged with master. When changes conflicts between master and <BranchName> occurs, git informs and puts the changes in the object.
git remote - shows existing remote repositories
git remote - v - shows existing repositories with URL.
git clone <RemoteRepositoryURL> - This will pull all the data from remote repository into local folder. Origin is an alias name of the repository cloned.
git fetch origin - This will fetch if any extra changes from remote repository to local. But it doesn't merge the changes.
git pull origin - It fetches if any extra changes from remote repository to local repository and merges the changes from remote branch to current branch.
git push origin master - This command is issued after all the needed changes are committed to finally submit changes to remote repository origin.
git remote add <Alias> <URL> - to add remote repositories.
I found a very nice explanation about git here. My git repository is here.
Installation : Git
Basic Commands:
Here are some basic git commands which can be helpful from time to time for a newbie or noob.
git init - To create and initialise repository in the current local path/folder
After issuing this command, it creates a hidden .git folder to store all the information
git status - Once you create some objects in the local repository, this status command can help to track the changes in object.
git add <ObjectName> - This is used to add an object to staging, which basically means it is ready to be pushed to remote repository. You can use 'git add .' to stage all the objects in the path. You can also use wildcard characters here. If you don't want certain files to be tracked. You can create a .gitignore file and specify the details there.
git commit - m "<Your Commit Message>" - This is used to commit the changes
git log - Shows commit history with basic details
git branch <BranchName> - To create new branch. Branches are used when you want to do the change without impact the original file. The name of main branch is 'master'.
git checkout <BranchName> - To switch to a branch.
git branch -d <BranchName> - To delete branch.
git diff <SourceBranch> <TargetBranch> - shows difference between source and target branch.
git merge <BranchName> - First switch to master branch. Then issue this command so that all the changes done in <BranchName> will be merged with master. When changes conflicts between master and <BranchName> occurs, git informs and puts the changes in the object.
git remote - shows existing remote repositories
git remote - v - shows existing repositories with URL.
git clone <RemoteRepositoryURL> - This will pull all the data from remote repository into local folder. Origin is an alias name of the repository cloned.
git fetch origin - This will fetch if any extra changes from remote repository to local. But it doesn't merge the changes.
git pull origin - It fetches if any extra changes from remote repository to local repository and merges the changes from remote branch to current branch.
git push origin master - This command is issued after all the needed changes are committed to finally submit changes to remote repository origin.
git remote add <Alias> <URL> - to add remote repositories.
I found a very nice explanation about git here. My git repository is here.