Create a directory to clone(Copy) project from Github in terminal:
mkdir budget_app
git pull (or) git pull origin master
: If you’re working on your local computer and want the most up-to-date version of your repository to work with, you “pull” the changes down from GitHub with this command.
: If you’re working on your local computer and want the most up-to-date version of your repository to work with, you “pull” the changes down from GitHub with this command.
git push
: If you’re working on your local computer, and want your commits to be visible online on GitHub as well, you “push” the changes up to GitHub with this command.
: If you’re working on your local computer, and want your commits to be visible online on GitHub as well, you “push” the changes up to GitHub with this command.
To check the current Branch:-
git branch
: Working with multiple collaborators and want to make changes on your own? This command will let you build a new branch, or timeline of commits, of changes and file additions that are completely your own. Your title goes after the command. If you wanted a new branch called “cats,” you’d type git branch cats
To add a file before commit:-
git add <file>
: This does not add new files to your repository. Instead, it brings new files to Git’s attention. After you add files, they’re included in Git’s “snapshots” of the repository.
To commit a file which has been changed by you:
git commit -m "Data valut changes" src/com/budget/AddDocumentDetails.java
If you are working in another branch please commit to that branch using:-
git push origin <current branch name>
To switch over to master(another) branch:-
git checkout master
: Literally allows you to “check out” a repository that you are not currently inside. This is a navigational command that lets you move to the repository you want to check. You can use this command as git checkout master to look at the master branch, or git checkout cats to look at another branch.
To merge the new branch to master branch:-
git merge <branch name>
: When you’re done working on a branch, you can merge your changes back to the master branch, which is visible to all collaborators. git merge cats would take all the changes you made to the “cats” branch and add them to the master.
To check the log:-
git log
To remove a file from git:-
git rm <file name>
To revert a commit:-
git reset --hard <commit id>
After reverting a commit:
git push <branch> --force
When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To check out the original branch and stop rebasing run "git rebase --abort".
To reset a Conflict merge:-
git reset --merge
To reset a particular commit:-
git cherry-pick <commit id>
To add the file to previous commit:-
git commit --amend
To see the difference:
git diff --staged
For Initial Commit:-
cd my_project
git init
: Initializes a new Git repository. Until you run this command inside a repository or directory, it’s just a regular folder. Only after you input this does it accept further Git commands.
git add <respective files>
: This does not add new files to your repository. Instead, it brings new files to Git’s attention. After you add files, they’re included in Git’s “snapshots” of the repository.
: This does not add new files to your repository. Instead, it brings new files to Git’s attention. After you add files, they’re included in Git’s “snapshots” of the repository.
git commit -m “Initial Commit”
: Git’s most important command. After you make any sort of change, you input this in order to take a “snapshot” of the repository. Usually it goes git commit -m “Message here.” The -m indicates that the following section of the command should be read as a message.
: Git’s most important command. After you make any sort of change, you input this in order to take a “snapshot” of the repository. Usually it goes git commit -m “Message here.” The -m indicates that the following section of the command should be read as a message.
git push -u origin master
Color the Git Console:-
git config --global color.ui auto
: Short for “configure,” this is most useful when you’re setting up Git for the first time.
: Short for “configure,” this is most useful when you’re setting up Git for the first time.