Git Command
1. git clone -b branchName url
Copy url from git clone option from repository.
2. git status
To check if git there is any new file or not and basic git status.
3. git branch
To get details about git branches. If star ⭐ is in front then it's currently points to that branch.
4. git branch branchName
Create a new branch.
5. git checkout branchName
Points to branch name specified.
6. git add .
All the files from local to staging.
7. git add fileName
Add a particular file.
8. git commit -m "first commit"
Commit all files in staging so that it will be ready for migration.
9. git config --get remote.origin.url
Just to verify if code is pointing to right repository.
10. git push -u origin branchName
Move code to git repository.
11. Create a pull request to merge code from branchName to master branch.
Error 1. Some of the files are not moving to staging area in git add .
Files were in state modified/ Untracked
Structure was like below.
Main folder:
- .git
- sub folder 1
- sub folder 2
- .git
- file1
Git was not able to move files from sub folder 2. May be we might have created another git repository inside sub folder 2.
So in order to resolve this issue we deleted .git folder from sub folder 2. Now git add . Worked as expected.
Comments
Post a Comment