Skip to content

Instantly share code, notes, and snippets.

@gunjanpatel
Last active January 3, 2016 23:19
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save gunjanpatel/8534613 to your computer and use it in GitHub Desktop.
Save gunjanpatel/8534613 to your computer and use it in GitHub Desktop.
Working with git daily - Tasol

Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly:

    git config --global user.name "Your Name"
    git config --global user.email you@example.com

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

For the first time clone your repository in to local linux.

    git clone <your_repo_url(forked)>

Using Terminal

  1. For the very first time if you didn't configured remote repository then do it using this command.

     git remote add tasol <remote_repo_url(From where you have forked)>
    
  2. Fetch changes from remote repository.

    git fetch tasol 
    
  3. Configure local working branch:

Informative way

    git branch <new_local_branch_name> tasol/master
    git checkout <new_local_branch_name>

Recommended Way

    git checkout -b <new_local_branch_name> tasol/master         

or

    git merge tasol/master
  1. To Commit local branch

     git commit -a -m "Your commit message"
    
  2. Push you local branch on your Github Repository.

     git push origin <new_local_branch_name>
    

    If you want to push your local branch into new remote branch then

     git push origin <new_local_branch_name>:<remote_branch_name>
    

Discard uncommitted changes

    git checkout -- .

Remove your all local git branches

    git branch -D `git branch --merged | grep -v \* | xargs`

What is your .gitignore file not working?

.gitignore is only meant to prevent files from being tracked. Once a file is tracked, the ignore file has no effect on it.

You can make Git ignore changes to your file using

    git update-index --assume-unchanged <your_file_path_which_needs_to_be_ignore>

Enjoy GIT with Linux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment