Showing posts with label github. Show all posts
Showing posts with label github. Show all posts

Friday 5 July 2019

How to add file into gitignore which is already push into github

Step 1 : You need to soft remove from git : $ git rm --cached tax.txt
Step 2 : Add tax.txt file in .gitignore
Step 3 : commit and push.
Step 4 : Finished!

Thursday 22 September 2016

Adding an existing project to GitHub /Bitbucket using the command line

1. Create a new repository on GitHub. To avoid errors, do not initialize the new repository with README, license, or gitignore files. You can add these files after your project has been pushed to GitHub.

2. Open Terminal.

3. Change the current working directory to your local project.

4. Initialize the local directory as a Git repository.
    $ git init

5. Add the files in your new local repository. This stages them for the first commit.
    $ git add .
    # Adds the files in the local repository and stages them for commit. To unstage a file, use 'git reset HEAD YOUR-FILE'.

6. Commit the files that you've staged in your local repository.
    $ git commit -m "First commit"
    # Commits the tracked changes and prepares them to be pushed to a remote repository. To remove this commit and modify the file, use 'git reset --soft HEAD~1' and commit and add the file again.

7. At the top of your GitHub repository's Quick Setup page, click to copy the remote repository URL.

8. In Terminal, add the URL for the remote repository where your local repository will be pushed.
    $ git remote add origin remote repository URL
    # Sets the new remote
    $ git remote -v
    # Verifies the new remote URL

9. Push the changes in your local repository to GitHub.
    $ git push origin master
    # Pushes the changes in your local repository up to the remote repository you specified as the origin

Friday 8 July 2016

How to change author name on GitHub/Bitbucket?

If you put your GitHub username and email account in those settings, your commits will accurately reflect your GitHub account as the right author.
$ git config --global user.name "Scott Chacon"
$ git config --global user.email "schacon@gmail.com"

Friday 24 June 2016

How do I delete/reset unpushed commits on Git / Bitbucket

Delete the most recent commit, keeping the work you've done:

git reset --soft HEAD~1

Delete the most recent commit, destroying the work you've done:

git reset --hard HEAD~1

Tuesday 14 June 2016

Merging master branch from another sub branch in Github, Bitbucket

There are Two way for merge branch

First Way For Merge branch
  1. Open Terminal.
  2. Change the current working directory to your local project.
  3. Check out the branch you wish to merge to. Usually, you will merge into master
    • $ git checkout master
  4. Pull the desired branch from the upstream repository. This method will retain the commit history without modification.
    • $ git pull https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git BRANCH_NAME
  5. If there are conflicts, resolve them. For more information, see "Resolving a merge conflict from the command line".
  6. Commit the merge.
  7. Review the changes and ensure they are satisfactory.
  8. Push the merge to your GitHub repository.
    • $ git push origin master


Second Way For Merge branch
$ git checkout master
$ git pull origin master
$ git merge test
$ git push origin master 

Saturday 16 April 2016

How to ignore chmod/permission of files and directory changes on git/bitbucket

if you want a git/bitbucket repository to ignore permission changes (chmod),
type the following command into the Terminal while inside the git/bitbucket repository:

git config core.filemode false
It is usually possible to do this for all git repositories at once, instead of going one-by-one.
This is done by using the following command inside the Terminal (no need to be inside a git repository for this command):

git config --global core.filemode false

Tuesday 17 November 2015

How to upload a project to Github





  1. cd var/www/html/github/my-first-pro/
  2. git add .
  3. git commit -m "adding files". -m
  4. git commit -m "adding files". -a
  5. git remote add origin https://github.com/Kanasagra-Jaydip/my-first-pro.git
  6. git push -u origin master

Here is how you would do it in Windows:
  1. If you don't have git installed, see this article on how to set it up.
  2. Open up a Windows command prompt.
  3. Change into the directory where your source code is located in the command prompt.
  4. First, create a new repository in this directory git init. This will say "Initialized empty git repository in ....git" (... is the path).
  5. Now you need to tell git about your files by adding them to your repository. Do this with git add filename. If you want to add all your files, you can do git add .
  6. Now that you have added your files and made your changes, you need to commit your changes so git can track them. Type git commit -m "adding files". -m lets you add the commit message in line.
So far, the above steps is what you would do even if you were not using github. They are the normal steps to start a git repository. Remember that git is distributed (decentralized), means you don't need to have a "central server" (or even a network connection), to use git.
Now you want to push the changes to your git repository hosted with github. To you this by telling git to add a remote location, and you do that with this command:
git remote add origin https://github.com/yourusername/your-repo-name.git
Once you have done that, git now knows about your remote repository. You can then tell it to push (which is "upload") your commited files:
git push -u origin master