I work with git. I created a directory reflections4 and I copied a file in it. After this, I executed git init.
git log displays
carlotavina (master #) reflections4 $ git log
fatal: your current branch 'master' does not have any commits yet
git status
carlotavina (master #) reflections4 $ git status
On branch master
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
lesson_1_reflections.txt
nothing added to commit but untracked files present (use "git add" to track)
How can I display Initial commit in git status after creating a repository
You have not yet committed anything to the repository, only initialized one. From the documentation, linked below, init creates an empty repository, and does no population. Some services (github/lab, etc) will initialize the repository with a readme file or similar, which must be committed to be tracked. Manually running init does not do this.
You must add (commit) something to the empty repo it to see it. As such, if you git add lesson_1_reflections.txt
and git commit -m "first commit"
, you will than have a commit that you are able to look at.
If you are trying to sync with a remote repository (one hosted on another server, github, gitlab, bitbucket, etc.), there are additional steps you will have to take to make the two repositories (local and remote) talk to each other.
Step 1:
git add lesson_1_reflections.txt
Step 2:
git commit -m "<enter the desired commit message>"
Step 3 (after you set up a remote to push into):
git push
If prompted enter user and password
https://confluence.atlassian.com/bitbucketserver/basic-git-commands-776639767.html Lookout on this webpage you will find every information you want.
In your case, you have to add those files to your repository by
git add . // . means everything or "all"
git status // now you can see all the changes
git commit -m "Message that you want to send regarding this commit"
git push origin "whatever the branch name"(optional)
When you have empty repo. You can follow these steps for doing initial commit.
git clone <your git repo url>
cd
command and create a local branch say developement
using command git checkout -b development
echo "A new repo" > Readme
git add.
git status
git commit -m "Adding readme file"
git push -u origin development:development
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.